X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8ae317e0027ef40c81d29f875dd6ccfc805e3bb0..8c3a0efe8b75a06279998e66a932d8a56c483961:/website/details.php?ds=sidebyside diff --git a/website/details.php b/website/details.php index 44d4956b..6f7c807d 100644 --- a/website/details.php +++ b/website/details.php @@ -37,12 +37,24 @@ if ($sOutputFormat == 'html' && !$sPlaceId && !$sOsmType) { 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