X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/49dc62201c1960f0d4279a440c1c29919b3d21b8..1e902ef60797be97f8b95cc716af01789e8be14c:/website/details.php diff --git a/website/details.php b/website/details.php index e2a8a031..6989d488 100755 --- a/website/details.php +++ b/website/details.php @@ -16,15 +16,21 @@ $sLanguagePrefArraySQL = 'ARRAY['.join(',', array_map('getDBQuoted', $aLangPrefO $sPlaceId = $oParams->getString('place_id'); $sOsmType = $oParams->getSet('osmtype', array('N', 'W', 'R')); $iOsmId = $oParams->getInt('osmid', -1); +$sClass = $oParams->getString('class'); $oDB =& getDB(); if ($sOsmType && $iOsmId > 0) { $sSQL = sprintf( - "SELECT place_id FROM placex WHERE osm_type='%s' AND osm_id=%d ORDER BY type='postcode' ASC", + "SELECT place_id FROM placex WHERE osm_type='%s' AND osm_id=%d", $sOsmType, $iOsmId ); + // osm_type and osm_id are not unique enough + if ($sClass) { + $sSQL .= " AND class='".$sClass."'"; + } + $sSQL .= ' ORDER BY class ASC'; $sPlaceId = chksql($oDB->getOne($sSQL)); // Be nice about our error messages for broken geometry