]> git.openstreetmap.org Git - nominatim.git/commitdiff
also adapt uses of ClassTypes in website/
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 17 May 2020 14:32:42 +0000 (16:32 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 17 May 2020 14:46:45 +0000 (16:46 +0200)
lib/Geocode.php
lib/template/details-html.php
lib/template/details-json.php
website/details.php
website/hierarchy.php
website/lookup.php
website/reverse.php

index 9bb4d46aba94c4ad8847c7d03dcfd3ad9494ede4..253b9798950d2cda202c86fdda1636a28aca049c 100644 (file)
@@ -897,7 +897,7 @@ class Geocode
         foreach ($aSearchResults as $iIdx => $aResult) {
             $fRadius = ClassTypes\getDefRadius($aResult);
 
-            $aOutlineResult = $this->oPlaceLookup->getOutlines($aResult['place_id'], $aResult['lon'], $aResult['lat'], $fDiameter);
+            $aOutlineResult = $this->oPlaceLookup->getOutlines($aResult['place_id'], $aResult['lon'], $aResult['lat'], $fRadius);
             if ($aOutlineResult) {
                 $aResult = array_merge($aResult, $aOutlineResult);
             }
@@ -905,7 +905,7 @@ class Geocode
             // Is there an icon set for this type of result?
             $sIcon = ClassTypes\getIcon($aResult);
             if (isset($sIcon)) {
-                $aResult['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$aIcon.'.p.20.png';
+                $aResult['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.p.20.png';
             }
 
             $sLabel = ClassTypes\getLabel($aResult);
@@ -941,7 +941,7 @@ class Geocode
                 // - number of exact matches from the query
                 $aResult['foundorder'] -= $aResults[$aResult['place_id']]->iExactMatches;
                 // - importance of the class/type
-                $iClassImportance = ClassTypes/getImportance($aResult);
+                $iClassImportance = ClassTypes\getImportance($aResult);
                 if (isset($iClassImportance)) {
                     $aResult['foundorder'] += 0.0001 * $iClassImportance;
                 } else {
index 43ec12668ec26a26e0748b24cdce344f1230866c..4ea5a258d5de6a58e832b59f91194957fb17e41c 100644 (file)
@@ -59,7 +59,7 @@
 
     function map_icon($sIcon)
     {
-        if ($sIcon){
+        if (isset($sIcon)) {
             echo '<img id="mapicon" src="'.CONST_Website_BaseURL.'images/mapicons/'.$sIcon.'.n.32.png'.'" alt="'.$sIcon.'" />';
         }
     }
index d5338a05a1a58e23b388d4c56028c308ce8feea9..4dc65a5b0d3637e7c27294c0414ab37a2e9b261a 100644 (file)
@@ -26,7 +26,7 @@ $aPlaceDetails['calculated_importance'] = (float) $aPointDetails['calculated_imp
 
 $aPlaceDetails['extratags'] = $aPointDetails['aExtraTags'];
 $aPlaceDetails['calculated_wikipedia'] = $aPointDetails['wikipedia'];
-if ($aPointDetails['icon']) {
+if (isset($aPointDetails['icon'])) {
     $aPlaceDetails['icon'] = CONST_Website_BaseURL.'images/mapicons/'.$aPointDetails['icon'].'.n.32.png';
 }
 
index 6f7c807d88d58890ec235ec0f519833a7c2ca0c1..73c07ba7fff3274bd7216fa4614c4c80afcf13c7 100644 (file)
@@ -149,7 +149,7 @@ if (!$aPointDetails) {
 }
 
 $aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
-$aPointDetails['icon'] = Nominatim\ClassTypes\getProperty($aPointDetails, 'icon', false);
+$aPointDetails['icon'] = Nominatim\ClassTypes\getIcon($aPointDetails);
 $aPointDetails['rank_search_label'] = getSearchRankLabel($aPointDetails['rank_search']); // only used in HTML format
 
 // Get all alternative names (languages, etc)
index e2db3edea3b54d754d80fb08266f3a5e6b05fb7b..66699f554524b053c193c9f4bad24f5398cae584 100644 (file)
@@ -103,10 +103,8 @@ if (!empty($aParentOfLines)) {
     echo '<h2>Parent Of:</h2>';
     $aGroupedAddressLines = array();
     foreach ($aParentOfLines as $aAddressLine) {
-        $aAddressLine['label'] = Nominatim\ClassTypes\getProperty($aAddressLine, 'label');
-        if (!$aAddressLine['label']) {
-            $aAddressLine['label'] = ucwords($aAddressLine['type']);
-        }
+        $aAddressLine['label'] = Nominatim\ClassTypes\getLabel($aAddressLine)
+                                 ?? ucwords($aAddressLine['type']);
 
         if (!isset($aGroupedAddressLines[$aAddressLine['label']])) $aGroupedAddressLines[$aAddressLine['label']] = array();
             $aGroupedAddressLines[$aAddressLine['label']][] = $aAddressLine;
index 7675ae1358006870631a8055c69812b8a00a4679..db2c01d647fd0afb4ceea11f0da84c718ee02806 100644 (file)
@@ -58,7 +58,7 @@ foreach ($aOsmIds as $sItem) {
                 $oPlace['place_id'],
                 $oPlace['lon'],
                 $oPlace['lat'],
-                Nominatim\ClassTypes\getProperty($oPlace, 'defdiameter', 0.0001)
+                Nominatim\ClassTypes\getDefRadius($oPlace)
             );
 
             if ($aOutlineResult) {
index 7b9ef3b3b264c71e5ae894f3e5348a49be9ea84a..29340a921fd4aa9ebbd77e783d174e5ccf2012a9 100644 (file)
@@ -55,7 +55,7 @@ if (isset($aPlace)) {
         $aPlace['place_id'],
         $aPlace['lon'],
         $aPlace['lat'],
-        Nominatim\ClassTypes\getProperty($aPlace, 'defdiameter', 0.0001),
+        Nominatim\ClassTypes\getDefRadius($aPlace),
         $fLat,
         $fLon
     );