]> git.openstreetmap.org Git - nominatim.git/commitdiff
details: check for unknown object and icons
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 9 Oct 2016 20:07:30 +0000 (22:07 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 9 Oct 2016 20:14:19 +0000 (22:14 +0200)
website/details.php

index 61ed4c639e5642e25d82384ccedaac4a6e1cfcb0..1276a0382ad5f97ac20f39be1d3c50ba053cc9a8 100755 (executable)
@@ -66,11 +66,23 @@ $sSQL .= " ST_y(centroid) as lat, ST_x(centroid) as lon,";
 $sSQL .= " case when importance = 0 OR importance IS NULL then 0.75-(rank_search::float/40) else importance end as calculated_importance, ";
 $sSQL .= " ST_AsText(CASE WHEN ST_NPoints(geometry) > 5000 THEN ST_SimplifyPreserveTopology(geometry, 0.0001) ELSE geometry END) as outlinestring";
 $sSQL .= " from placex where place_id = $iPlaceID";
+
 $aPointDetails = chksql($oDB->getRow($sSQL), "Could not get details of place object.");
+
+if (!$aPointDetails) {
+    userError("Unknown place id.");
+}
+
 $aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber'];
 
 $aClassType = getClassTypesWithImportance();
-$aPointDetails['icon'] = $aClassType[$aPointDetails['class'].':'.$aPointDetails['type']]['icon'];
+
+$sPointClassType = $aPointDetails['class'].':'.$aPointDetails['type'];
+if (isset($aClassType[$sPointClassType]) && $aClassType[$aPointDetails]['icon']) {
+    $aPointDetails['icon'] = $aClassType[$aPointClassType]['icon'];
+} else {
+    $aPointDetails['icon'] = false;
+}
 
 // Get all alternative names (languages, etc)
 $sSQL = "select (each(name)).key,(each(name)).value from placex where place_id = $iPlaceID order by (each(name)).key";