X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/36e99c43cedeb557fb911064a3311bc99b8a44a0..a5e37858438a181d6d69b82057833231ff067c81:/website/details.php 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