Add options to output polygon in various formats: polygon_geojson=1&polygon_svg=1&polygon_kml=1&polygon_text=1 They can be all used at the same time if prefered. Where format and polygon type are compatible output is as native type e.g. format=json&polygon_geojson=1

This commit is contained in:
Brian Quinion
2012-11-06 00:08:01 +00:00
parent c0d9ba7e0c
commit 753d2ac79f
4 changed files with 117 additions and 25 deletions

View File

@@ -49,6 +49,26 @@
$aPlace['address'] = $aPointDetails['address'];
}
if (isset($aResult['asgeojson']))
{
$aPlace['geojson'] = json_decode($aResult['asgeojson']);
}
if (isset($aResult['assvg']))
{
$aPlace['svg'] = $aResult['assvg'];
}
if (isset($aResult['astext']))
{
$aPlace['geotext'] = $aResult['astext'];
}
if (isset($aResult['askml']))
{
$aPlace['geokml'] = $aResult['askml'];
}
$aFilteredPlaces[] = $aPlace;
}

View File

@@ -50,7 +50,27 @@
$aPlace['address'] = $aPointDetails['address'];
}
if (isset($aResult['asgeojson']))
{
$aPlace['geojson'] = json_decode($aResult['asgeojson']);
}
if (isset($aResult['assvg']))
{
$aPlace['svg'] = $aResult['assvg'];
}
if (isset($aResult['astext']))
{
$aPlace['geotext'] = $aResult['astext'];
}
if (isset($aResult['askml']))
{
$aPlace['geokml'] = $aResult['askml'];
}
$aFilteredPlaces[] = $aPlace;
}
javascript_renderData($aFilteredPlaces);
javascript_renderData($aFilteredPlaces, array('geojson'));

View File

@@ -50,6 +50,27 @@
}
}
if (isset($aResult['asgeojson']))
{
echo ' geojson=\'';
echo $aResult['asgeojson'];
echo '\'';
}
if (isset($aResult['assvg']))
{
echo ' geosvg=\'';
echo $aResult['assvg'];
echo '\'';
}
if (isset($aResult['astext']))
{
echo ' geotext=\'';
echo $aResult['astext'];
echo '\'';
}
if (isset($aResult['zoom']))
{
echo " zoom='".$aResult['zoom']."'";
@@ -66,9 +87,20 @@
echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
}
if (isset($aResult['address']))
if (isset($aResult['address']) || isset($aResult['askml']))
{
echo ">";
}
if (isset($aResult['askml']))
{
echo "\n";
echo $aResult['askml'];
}
if (isset($aResult['address']))
{
echo "\n";
foreach($aResult['address'] as $sKey => $sValue)
{
$sKey = str_replace(' ','_',$sKey);
@@ -76,7 +108,10 @@
echo htmlspecialchars($sValue);
echo "</$sKey>";
}
}
if (isset($aResult['address']) || isset($aResult['askml']))
{
echo "</place>";
}
else