From: Sarah Hoffmann Date: Sun, 17 May 2020 14:32:42 +0000 (+0200) Subject: also adapt uses of ClassTypes in website/ X-Git-Tag: v3.5.0~8^2~3 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/859347523fb2c7340b2df9980e52d5ea4543c82d also adapt uses of ClassTypes in website/ --- diff --git a/lib/Geocode.php b/lib/Geocode.php index 9bb4d46a..253b9798 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -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 { diff --git a/lib/template/details-html.php b/lib/template/details-html.php index 43ec1266..4ea5a258 100644 --- a/lib/template/details-html.php +++ b/lib/template/details-html.php @@ -59,7 +59,7 @@ function map_icon($sIcon) { - if ($sIcon){ + if (isset($sIcon)) { echo ''.$sIcon.''; } } diff --git a/lib/template/details-json.php b/lib/template/details-json.php index d5338a05..4dc65a5b 100644 --- a/lib/template/details-json.php +++ b/lib/template/details-json.php @@ -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'; } diff --git a/website/details.php b/website/details.php index 6f7c807d..73c07ba7 100644 --- a/website/details.php +++ b/website/details.php @@ -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) diff --git a/website/hierarchy.php b/website/hierarchy.php index e2db3ede..66699f55 100644 --- a/website/hierarchy.php +++ b/website/hierarchy.php @@ -103,10 +103,8 @@ if (!empty($aParentOfLines)) { echo '

Parent Of:

'; $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; diff --git a/website/lookup.php b/website/lookup.php index 7675ae13..db2c01d6 100644 --- a/website/lookup.php +++ b/website/lookup.php @@ -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) { diff --git a/website/reverse.php b/website/reverse.php index 7b9ef3b3..29340a92 100644 --- a/website/reverse.php +++ b/website/reverse.php @@ -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 );