X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/85ab12c4716ce96f4d666fcc0bd59fa32d68874e..0e3ac756c9ad412cbbb7d1d1399eeec1bd50c0bd:/website/details.php diff --git a/website/details.php b/website/details.php index ff90cd98..dcfe2090 100755 --- a/website/details.php +++ b/website/details.php @@ -15,9 +15,27 @@ $oDB =& getDB(); + $aLangPrefOrder = getPreferredLanguages(); + $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]"; + if (isset($_GET['osmtype']) && isset($_GET['osmid']) && (int)$_GET['osmid'] && ($_GET['osmtype'] == 'N' || $_GET['osmtype'] == 'W' || $_GET['osmtype'] == 'R')) { $_GET['place_id'] = $oDB->getOne("select place_id from placex where osm_type = '".$_GET['osmtype']."' and osm_id = ".(int)$_GET['osmid']." order by type = 'postcode' asc"); + + // Be nice about our error messages for broken geometry + if (!$_GET['place_id']) + { + $aPointDetails = $oDB->getRow("select osm_type, osm_id, errormessage, class, type, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, ST_AsText(prevgeometry) as prevgeom, ST_AsText(newgeometry) as newgeom from import_polygon_error where osm_type = '".$_GET['osmtype']."' and osm_id = ".(int)$_GET['osmid']." order by updated desc limit 1"); + if (!PEAR::isError($aPointDetails) && $aPointDetails) { + if (preg_match('/\[(-?\d+\.\d+) (-?\d+\.\d+)\]/', $aPointDetails['errormessage'], $aMatches)) + { + $aPointDetails['error_x'] = $aMatches[1]; + $aPointDetails['error_y'] = $aMatches[2]; + } + include(CONST_BasePath.'/lib/template/details-error-'.$sOutputFormat.'.php'); + exit; + } + } } if (!isset($_GET['place_id'])) @@ -33,9 +51,6 @@ $iParentPlaceID = $oDB->getOne('select parent_place_id from location_property_aux where place_id = '.$iPlaceID); if ($iParentPlaceID) $iPlaceID = $iParentPlaceID; - $aLangPrefOrder = getPrefferedLangauges(); - $sLanguagePrefArraySQL = "ARRAY[".join(',',array_map("getDBQuoted",$aLangPrefOrder))."]"; - $hLog = logStart($oDB, 'details', $_SERVER['QUERY_STRING'], $aLangPrefOrder); // Make sure the point we are reporting on is fully indexed