X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/032f24bfefcd6c8b5a2211a361430f5523150ab1..909b0c7462b336d07cab4499529957a4096a8c18:/website/details.php diff --git a/website/details.php b/website/details.php index 0dc3397a..4d7c1efb 100755 --- a/website/details.php +++ b/website/details.php @@ -73,6 +73,9 @@ if (CONST_Use_US_Tiger_Data) { $iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_property_osmline WHERE place_id = '.$iPlaceID)); if ($iParentPlaceID) $iPlaceID = $iParentPlaceID; +// artificial postcodes +$iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_postcode WHERE place_id = '.$iPlaceID)); +if ($iParentPlaceID) $iPlaceID = $iParentPlaceID; if (CONST_Use_Aux_Location_data) { $iParentPlaceID = chksql($oDB->getOne('SELECT parent_place_id FROM location_property_aux WHERE place_id = '.$iPlaceID)); @@ -83,7 +86,7 @@ $hLog = logStart($oDB, 'details', $_SERVER['QUERY_STRING'], $aLangPrefOrder); // Get the details for this point $sSQL = "SELECT place_id, osm_type, osm_id, class, type, name, admin_level,"; -$sSQL .= " housenumber, street, isin, postcode, calculated_country_code AS country_code,"; +$sSQL .= " housenumber, postcode, country_code,"; $sSQL .= " importance, wikipedia,"; $sSQL .= " to_char(indexed_date, 'YYYY-MM-DD HH24:MI') AS indexed_date,"; $sSQL .= " parent_place_id, "; @@ -99,10 +102,10 @@ $sSQL .= " CASE "; $sSQL .= " WHEN importance = 0 OR importance IS NULL THEN 0.75-(rank_search::float/40) "; $sSQL .= " ELSE importance "; $sSQL .= " END as calculated_importance, "; -$sSQL .= " ST_AsText(CASE "; +$sSQL .= " ST_AsGeoJSON(CASE "; $sSQL .= " WHEN ST_NPoints(geometry) > 5000 THEN ST_SimplifyPreserveTopology(geometry, 0.0001) "; $sSQL .= " ELSE geometry "; -$sSQL .= " END) as outlinestring"; +$sSQL .= " END) as asgeojson"; $sSQL .= " FROM placex "; $sSQL .= " WHERE place_id = $iPlaceID"; @@ -130,6 +133,13 @@ if (PEAR::isError($aPointDetails['aNames'])) { // possible timeout $aPointDetails['aNames'] = []; } +// Address tags +$sSQL = "SELECT (each(address)).key as key,(each(address)).value FROM placex WHERE place_id = $iPlaceID ORDER BY key"; +$aPointDetails['aAddressTags'] = $oDB->getAssoc($sSQL); +if (PEAR::isError($aPointDetails['aAddressTags'])) { // possible timeout + $aPointDetails['aAddressTags'] = []; +} + // Extra tags $sSQL = "SELECT (each(extratags)).key,(each(extratags)).value FROM placex WHERE place_id = $iPlaceID ORDER BY (each(extratags)).key"; $aPointDetails['aExtraTags'] = $oDB->getAssoc($sSQL);