mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-16 15:47:58 +00:00
replace deprecated postgis functions
ST_Line_Locate_Point and ST_Distance_Spheroid have changed spelling in newer version and throw a deprecation warning.
This commit is contained in:
@@ -98,7 +98,7 @@ class ReverseGeocode
|
|||||||
// if a street or house was found, look in interpolation lines table
|
// if a street or house was found, look in interpolation lines table
|
||||||
if ($bDoInterpolation && $this->iMaxRank >= 28 && $aPlace && $aPlace['rank_search'] >= 26) {
|
if ($bDoInterpolation && $this->iMaxRank >= 28 && $aPlace && $aPlace['rank_search'] >= 26) {
|
||||||
// if a house was found, search the interpolation line that is at least as close as the house
|
// if a house was found, search the interpolation line that is at least as close as the house
|
||||||
$sSQL = 'SELECT place_id, parent_place_id, 30 as rank_search, ST_line_locate_point(linegeo,'.$sPointSQL.') as fraction';
|
$sSQL = 'SELECT place_id, parent_place_id, 30 as rank_search, ST_LineLocatePoint(linegeo,'.$sPointSQL.') as fraction';
|
||||||
$sSQL .= ' FROM location_property_osmline';
|
$sSQL .= ' FROM location_property_osmline';
|
||||||
$sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')';
|
$sSQL .= ' WHERE ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')';
|
||||||
$sSQL .= ' and indexed_status = 0 ';
|
$sSQL .= ' and indexed_status = 0 ';
|
||||||
@@ -161,7 +161,7 @@ class ReverseGeocode
|
|||||||
// Only street found? If it's in the US we can check TIGER data for nearest housenumber
|
// Only street found? If it's in the US we can check TIGER data for nearest housenumber
|
||||||
if (CONST_Use_US_Tiger_Data && $bDoInterpolation && $bIsInUnitedStates && $this->iMaxRank >= 28 && $iPlaceID && ($aPlace['rank_search'] == 26 || $aPlace['rank_search'] == 27 )) {
|
if (CONST_Use_US_Tiger_Data && $bDoInterpolation && $bIsInUnitedStates && $this->iMaxRank >= 28 && $iPlaceID && ($aPlace['rank_search'] == 26 || $aPlace['rank_search'] == 27 )) {
|
||||||
$fSearchDiam = 0.001;
|
$fSearchDiam = 0.001;
|
||||||
$sSQL = 'SELECT place_id,parent_place_id,30 as rank_search, ST_line_locate_point(linegeo,'.$sPointSQL.') as fraction';
|
$sSQL = 'SELECT place_id,parent_place_id,30 as rank_search, ST_LineLocatePoint(linegeo,'.$sPointSQL.') as fraction';
|
||||||
//if (CONST_Debug) { $sSQL .= ', housenumber, ST_distance('.$sPointSQL.', centroid) as distance, st_y(centroid) as lat, st_x(centroid) as lon'; }
|
//if (CONST_Debug) { $sSQL .= ', housenumber, ST_distance('.$sPointSQL.', centroid) as distance, st_y(centroid) as lat, st_x(centroid) as lon'; }
|
||||||
$sSQL .= ' FROM location_property_tiger WHERE parent_place_id = '.$iPlaceID;
|
$sSQL .= ' FROM location_property_tiger WHERE parent_place_id = '.$iPlaceID;
|
||||||
$sSQL .= ' AND ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')'; //no centroid anymore in Tiger data, now we have lines
|
$sSQL .= ' AND ST_DWithin('.$sPointSQL.', linegeo, '.$fSearchDiam.')'; //no centroid anymore in Tiger data, now we have lines
|
||||||
|
|||||||
@@ -124,8 +124,12 @@ if ($aCMDResult['setup-db'] || $aCMDResult['all']) {
|
|||||||
echo 'Postgis version found: '.$fPostgisVersion."\n";
|
echo 'Postgis version found: '.$fPostgisVersion."\n";
|
||||||
|
|
||||||
if ($fPostgisVersion < 2.1) {
|
if ($fPostgisVersion < 2.1) {
|
||||||
// Function was renamed in 2.1 and throws an annoying deprecation warning
|
// Functions were renamed in 2.1 and throw an annoying deprecation warning
|
||||||
pgsqlRunScript('ALTER FUNCTION st_line_interpolate_point(geometry, double precision) RENAME TO ST_LineInterpolatePoint');
|
pgsqlRunScript('ALTER FUNCTION st_line_interpolate_point(geometry, double precision) RENAME TO ST_LineInterpolatePoint');
|
||||||
|
pgsqlRunScript('ALTER FUNCTION ST_Line_Locate_Point(geometry, double precision) RENAME TO ST_LineLocatePoint');
|
||||||
|
}
|
||||||
|
if ($fPostgisVersion < 2.2) {
|
||||||
|
pgsqlRunScript('ALTER FUNCTION ST_Distance_Spheroid(geometry, double precision) RENAME TO ST_DistanceSpheroid');
|
||||||
}
|
}
|
||||||
|
|
||||||
pgsqlRunScriptFile(CONST_BasePath.'/data/country_name.sql');
|
pgsqlRunScriptFile(CONST_BasePath.'/data/country_name.sql');
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ if (PEAR::isError($aPointDetails['aExtraTags'])) { // possible timeout
|
|||||||
$aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], -1, true);
|
$aAddressLines = getAddressDetails($oDB, $sLanguagePrefArraySQL, $iPlaceID, $aPointDetails['country_code'], -1, true);
|
||||||
|
|
||||||
// Linked places
|
// Linked places
|
||||||
$sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
$sSQL = "select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_DistanceSpheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
||||||
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
||||||
$sSQL .= " from placex, (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
$sSQL .= " from placex, (select centroid as placegeometry from placex where place_id = $iPlaceID) as x";
|
||||||
$sSQL .= " where linked_place_id = $iPlaceID";
|
$sSQL .= " where linked_place_id = $iPlaceID";
|
||||||
@@ -101,7 +101,7 @@ if (PEAR::isError($aLinkedLines)) { // possible timeout
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All places this is an imediate parent of
|
// All places this is an imediate parent of
|
||||||
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_Distance_Spheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, ST_DistanceSpheroid(geometry, placegeometry, 'SPHEROID[\"WGS 84\",6378137,298.257223563, AUTHORITY[\"EPSG\",\"7030\"]]') as distance, ";
|
||||||
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
$sSQL .= " get_name_by_language(name,$sLanguagePrefArraySQL) as localname, length(name::text) as namelength ";
|
||||||
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
|
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
|
||||||
$sSQL .= " where parent_place_id = $iPlaceID order by rank_address asc,rank_search asc limit 500) as obj,";
|
$sSQL .= " where parent_place_id = $iPlaceID order by rank_address asc,rank_search asc limit 500) as obj,";
|
||||||
|
|||||||
Reference in New Issue
Block a user