]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/search-xml.php
cmake: use explicit VPATH when calling pgxs makefile
[nominatim.git] / lib / template / search-xml.php
index bdf1eab53ae93b19a8f04eca3b7ac83d6e8e4be1..54217933ef7d8962a5e3934b3186b6ae9cb8d57d 100644 (file)
@@ -1,16 +1,16 @@
 <?php
        header("content-type: text/xml; charset=UTF-8");
 <?php
        header("content-type: text/xml; charset=UTF-8");
-       header("Access-Control-Allow-Origin: *");
 
        echo "<";
        echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
        echo ">\n";
 
 
        echo "<";
        echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
        echo ">\n";
 
-       echo "<searchresults";
+       echo "<";
+       echo (isset($sXmlRootTag)?$sXmlRootTag:'searchresults');
        echo " timestamp='".date(DATE_RFC822)."'";
        echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
        echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
        echo " timestamp='".date(DATE_RFC822)."'";
        echo " attribution='Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright'";
        echo " querystring='".htmlspecialchars($sQuery, ENT_QUOTES)."'";
-       if (isset($sViewBox)) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
+       if ($sViewBox) echo " viewbox='".htmlspecialchars($sViewBox, ENT_QUOTES)."'";
        echo " polygon='".($bShowPolygons?'true':'false')."'";
        if (sizeof($aExcludePlaceIDs))
        {
        echo " polygon='".($bShowPolygons?'true':'false')."'";
        if (sizeof($aExcludePlaceIDs))
        {
@@ -25,7 +25,7 @@
        foreach($aSearchResults as $iResNum => $aResult)
        {
                echo "<place place_id='".$aResult['place_id']."'";
        foreach($aSearchResults as $iResNum => $aResult)
        {
                echo "<place place_id='".$aResult['place_id']."'";
-               $sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':'')));
+               $sOSMType = ($aResult['osm_type'] == 'N'?'node':($aResult['osm_type'] == 'W'?'way':($aResult['osm_type'] == 'R'?'relation':($aResult['osm_type'] == 'T'?'tiger':''))));
                if ($sOSMType)
                {
                        echo " osm_type='$sOSMType'";
                if ($sOSMType)
                {
                        echo " osm_type='$sOSMType'";
                if (isset($aResult['aBoundingBox']))
                {
                        echo ' boundingbox="';
                if (isset($aResult['aBoundingBox']))
                {
                        echo ' boundingbox="';
-                       echo $aResult['aBoundingBox'][0];
-                       echo ','.$aResult['aBoundingBox'][1];
-                       echo ','.$aResult['aBoundingBox'][2];
-                       echo ','.$aResult['aBoundingBox'][3];
+                       echo join(',',$aResult['aBoundingBox']);
                        echo '"';
 
                        if ($bShowPolygons && isset($aResult['aPolyPoints']))
                        echo '"';
 
                        if ($bShowPolygons && isset($aResult['aPolyPoints']))
                        }
                }
 
                        }
                }
 
+               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']."'";
                if (isset($aResult['zoom']))
                {
                        echo " zoom='".$aResult['zoom']."'";
                echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
 
                echo " class='".htmlspecialchars($aResult['class'])."'";
                echo " display_name='".htmlspecialchars($aResult['name'], ENT_QUOTES)."'";
 
                echo " class='".htmlspecialchars($aResult['class'])."'";
-               echo " type='".htmlspecialchars($aResult['type'])."'";
-               if ($aResult['icon'])
+               echo " type='".htmlspecialchars($aResult['type'], ENT_QUOTES)."'";
+               echo " importance='".htmlspecialchars($aResult['importance'])."'";
+               if (isset($aResult['icon']) && $aResult['icon'])
                {
                        echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
                }
 
                {
                        echo " icon='".htmlspecialchars($aResult['icon'], ENT_QUOTES)."'";
                }
 
+               $bHasDelim = false;
+
+               if (isset($aResult['askml']))
+               {
+                       if (!$bHasDelim)
+                       {
+                               $bHasDelim = true;
+                               echo ">";
+                       }
+                       echo "\n<geokml>";
+                       echo $aResult['askml'];
+                       echo "</geokml>";
+               }
+
+               if (isset($aResult['sExtraTags']))
+               {
+                       if (!$bHasDelim)
+                       {
+                               $bHasDelim = true;
+                               echo ">";
+                       }
+                       echo "\n<extratags>";
+                       foreach ($aResult['sExtraTags'] as $sKey => $sValue)
+                       {
+                               echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
+                       }
+                       echo "</extratags>";
+               }
+
+               if (isset($aResult['sNameDetails']))
+               {
+                       if (!$bHasDelim)
+                       {
+                               $bHasDelim = true;
+                               echo ">";
+                       }
+                       echo "\n<namedetails>";
+                       foreach ($aResult['sNameDetails'] as $sKey => $sValue)
+                       {
+                               echo '<name desc="'.htmlspecialchars($sKey).'">';
+                               echo htmlspecialchars($sValue);
+                               echo "</name>";
+                       }
+                       echo "</namedetails>";
+               }
+
                if (isset($aResult['address']))
                {
                if (isset($aResult['address']))
                {
-                       echo ">";
+                       if (!$bHasDelim)
+                       {
+                               $bHasDelim = true;
+                               echo ">";
+                       }
+                       echo "\n";
                        foreach($aResult['address'] as $sKey => $sValue)
                        {
                                $sKey = str_replace(' ','_',$sKey);
                        foreach($aResult['address'] as $sKey => $sValue)
                        {
                                $sKey = str_replace(' ','_',$sKey);
                                echo htmlspecialchars($sValue);
                                echo "</$sKey>";
                        }
                                echo htmlspecialchars($sValue);
                                echo "</$sKey>";
                        }
+               }
 
 
+               if ($bHasDelim)
+               {
                        echo "</place>";
                }
                else
                        echo "</place>";
                }
                else
                }
        }
        
                }
        }
        
-       echo "</searchresults>";
+       echo "</" . (isset($sXmlRootTag)?$sXmlRootTag:'searchresults') . ">";