]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib/template/address-xml.php
corrected layout of keywords on HTML details page
[nominatim.git] / lib / template / address-xml.php
index 75f69e1563c2a96cc8d27dddfb205a226680dcf8..39d9a14792171a0c0d0cd0efc60ff8fa73c7257b 100644 (file)
@@ -1,6 +1,5 @@
 <?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 "<";
        echo "?xml version=\"1.0\" encoding=\"UTF-8\" ?";
@@ -14,7 +13,7 @@
 
        if (!sizeof($aPlace))
        {
 
        if (!sizeof($aPlace))
        {
-               if ($sError)
+               if (isset($sError))
                        echo "<error>$sError</error>";
                else
                        echo "<error>Unable to geocode</error>";
                        echo "<error>$sError</error>";
                else
                        echo "<error>Unable to geocode</error>";
        {
                echo "<result";
                if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
        {
                echo "<result";
                if ($aPlace['place_id']) echo ' place_id="'.$aPlace['place_id'].'"';
-               if ($aPlace['osm_type'] && $aPlace['osm_id']) echo ' osm_type="'.($aPlace['osm_type']=='N'?'node':($aPlace['osm_type']=='W'?'way':'relation')).'"'.' osm_id="'.$aPlace['osm_id'].'"';
+               $sOSMType = ($aPlace['osm_type'] == 'N'?'node':($aPlace['osm_type'] == 'W'?'way':($aPlace['osm_type'] == 'R'?'relation':'')));
+               if ($sOSMType) echo ' osm_type="'.$sOSMType.'"'.' osm_id="'.$aPlace['osm_id'].'"';
                if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
                if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
                if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
                echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
 
                if ($aPlace['ref']) echo ' ref="'.htmlspecialchars($aPlace['ref']).'"';
                if (isset($aPlace['lat'])) echo ' lat="'.htmlspecialchars($aPlace['lat']).'"';
                if (isset($aPlace['lon'])) echo ' lon="'.htmlspecialchars($aPlace['lon']).'"';
                echo ">".htmlspecialchars($aPlace['langaddress'])."</result>";
 
-        if ($bShowAddressDetails) {
+               if (isset($aPlace['aAddress']))
+               {
                        echo "<addressparts>";
                        echo "<addressparts>";
-                       foreach($aAddress as $sKey => $sValue)
+                       foreach($aPlace['aAddress'] as $sKey => $sValue)
                        {
                                $sKey = str_replace(' ','_',$sKey);
                                echo "<$sKey>";
                        {
                                $sKey = str_replace(' ','_',$sKey);
                                echo "<$sKey>";
                                echo "</$sKey>";
                        }
                        echo "</addressparts>";
                                echo "</$sKey>";
                        }
                        echo "</addressparts>";
-        }
+               }
+
+               if (isset($aPlace['sExtraTags']))
+               {
+                       echo "<extratags>";
+                       foreach ($aPlace['sExtraTags'] as $sKey => $sValue)
+                       {
+                               echo '<tag key="'.htmlspecialchars($sKey).'" value="'.htmlspecialchars($sValue).'"/>';
+                       }
+                       echo "</extratags>";
+               }
+
+               if (isset($aPlace['sNameDetails']))
+               {
+                       echo "<namedetails>";
+                       foreach ($aPlace['sNameDetails'] as $sKey => $sValue)
+                       {
+                               echo '<name desc="'.htmlspecialchars($sKey).'">';
+                               echo htmlspecialchars($sValue);
+                               echo "</name>";
+                       }
+                       echo "</namedetails>";
+               }
        }
        }
-       
+
        echo "</reversegeocode>";
        echo "</reversegeocode>";