X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/850ab6999cb12520e1f00b39bf7803d6c47b3705..c70b6ccc6dd6f69e371dbf0bc9c40126a9a65e75:/website/details.php diff --git a/website/details.php b/website/details.php index cb371e6b..ff6ddaca 100644 --- a/website/details.php +++ b/website/details.php @@ -30,14 +30,31 @@ $oDB->connect(); $sLanguagePrefArraySQL = $oDB->getArraySQL($oDB->getDBQuotedList($aLangPrefOrder)); +if ($sOutputFormat == 'html' && !$sPlaceId && !$sOsmType) { + include(CONST_BasePath.'/lib/template/details-index-html.php'); + exit; +} + if ($sOsmType && $iOsmId > 0) { $sSQL = 'SELECT place_id FROM placex WHERE osm_type = :type AND osm_id = :id'; + $aSQLParams = array(':type' => $sOsmType, ':id' => $iOsmId); // osm_type and osm_id are not unique enough if ($sClass) { - $sSQL .= " AND class='".$sClass."'"; + $sSQL .= ' AND class= :class'; + $aSQLParams[':class'] = $sClass; } $sSQL .= ' ORDER BY class ASC'; - $sPlaceId = $oDB->getOne($sSQL, array(':type' => $sOsmType, ':id' => $iOsmId)); + $sPlaceId = $oDB->getOne($sSQL, $aSQLParams); + + + // Nothing? Maybe it's an interpolation. + // XXX Simply returns the first parent street it finds. It should + // get a house number and get the right interpolation. + if (!$sPlaceId && $sOsmType == 'W' && (!$sClass || $sClass == 'place')) { + $sSQL = 'SELECT place_id FROM location_property_osmline' + .' WHERE osm_id = :id LIMIT 1'; + $sPlaceId = $oDB->getOne($sSQL, array(':id' => $iOsmId)); + } // Be nice about our error messages for broken geometry @@ -132,7 +149,6 @@ if (!$aPointDetails) { } $aPointDetails['localname'] = $aPointDetails['localname']?$aPointDetails['localname']:$aPointDetails['housenumber']; -$aPointDetails['icon'] = Nominatim\ClassTypes\getProperty($aPointDetails, 'icon', false); $aPointDetails['rank_search_label'] = getSearchRankLabel($aPointDetails['rank_search']); // only used in HTML format // Get all alternative names (languages, etc)