X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/bfe51197429c9436034bb4d25931ad4d687d09c8..0e3ac756c9ad412cbbb7d1d1399eeec1bd50c0bd:/website/details.php diff --git a/website/details.php b/website/details.php index 7c6ad8ad..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 @@ -43,7 +58,7 @@ //$oDB->query($sSQL); // Get the details for this point - $sSQL = "select place_id, osm_type, osm_id, class, type, name, admin_level, housenumber, street, isin, postcode, country_code, importance,"; + $sSQL = "select place_id, osm_type, osm_id, class, type, name, admin_level, housenumber, street, isin, postcode, country_code, importance, wikipedia,"; $sSQL .= " parent_place_id, rank_address, rank_search, get_searchrank_label(rank_search) as rank_search_label, get_name_by_language(name,$sLanguagePrefArraySQL) as localname, "; $sSQL .= " ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea,ST_GeometryType(geometry) as geotype, ST_Y(ST_Centroid(geometry)) as lat,ST_X(ST_Centroid(geometry)) as lon "; $sSQL .= " from placex where place_id = $iPlaceID";