]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/search-xml.php
wrap KML polygon in XML output with geokml element
[nominatim.git] / lib / template / search-xml.php
index 6ceb53cd3be6e25ece4baa1087838f918dd7bdd6..fa6b14a37af693515b52473f071822fdb8172d78 100644 (file)
@@ -8,9 +8,9 @@
 
        echo "<searchresults";
        echo " timestamp='".date(DATE_RFC822)."'";
-       echo " attribution='Data Copyright OpenStreetMap Contributors, Some Rights Reserved. CC-BY-SA 2.0.'";
+       echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
        echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
-       if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
+       if (isset($sViewBox)) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
        echo " polygon='".($bShowPolygons?'true':'false')."'";
        if (sizeof($aExcludePlaceIDs))
        {
                        if ($bShowPolygons && isset($aResult['aPolyPoints']))
                        {
                                echo ' polygonpoints=\'';
-                               echo javascript_renderData($aResult['aPolyPoints']);
+                               echo json_encode($aResult['aPolyPoints']);
                                echo '\'';
                        }
                }
 
+               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']."'";
 
                echo " class='".htmlspecialchars($aResult['class'])."'";
                echo " type='".htmlspecialchars($aResult['type'])."'";
-               if ($aResult['icon'])
+               if (isset($aResult['icon']) && $aResult['icon'])
                {
                        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<geokml>";
+                       echo $aResult['askml'];
+                       echo "</geokml>";
+               }
+
+               if (isset($aResult['address']))
+               {
+                       echo "\n";
                        foreach($aResult['address'] as $sKey => $sValue)
                        {
                                $sKey = str_replace(' ','_',$sKey);
                                echo htmlspecialchars($sValue);
                                echo "</$sKey>";
                        }
+               }
 
+               if (isset($aResult['address']) || isset($aResult['askml']))
+               {
                        echo "</place>";
                }
                else