remove duplicate reverse geocoding code

Geocode now uses ReverseGeocode directly. Note that it currently
cannot support any interpolations, neither OSM nor Tiger. But
neither did the previous version.
This commit is contained in:
Sarah Hoffmann
2016-07-24 23:58:39 +02:00
parent a827367a2f
commit a766240c06
3 changed files with 14 additions and 90 deletions

View File

@@ -108,7 +108,7 @@
// returns { place_id =>, type => '(osm|tiger)' }
// fails if no place was found
function lookup()
function lookup($bDoInterpolation = true)
{
$sPointSQL = 'ST_SetSRID(ST_Point('.$this->fLon.','.$this->fLat.'),4326)';
$iMaxRank = $this->iMaxRank;
@@ -155,7 +155,7 @@
$bIsInUnitedStates = ($aPlace['calculated_country_code'] == 'us');
}
// if a street or house was found, look in interpolation lines table
if ($iMaxRank_orig >= 28 && $aPlace && $aPlace['rank_search'] >= 26)
if ($bDoInterpolation && $iMaxRank_orig >= 28 && $aPlace && $aPlace['rank_search'] >= 26)
{
// 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';
@@ -220,7 +220,7 @@
}
// Only street found? If it's in the US we can check TIGER data for nearest housenumber
if (CONST_Use_US_Tiger_Data && $bIsInUnitedStates && $iMaxRank_orig >= 28 && $iPlaceID && ($aPlace['rank_search'] == 26 || $aPlace['rank_search'] == 27 ))
if (CONST_Use_US_Tiger_Data && $bDoInterpolation && $bIsInUnitedStates && $iMaxRank_orig >= 28 && $iPlaceID && ($aPlace['rank_search'] == 26 || $aPlace['rank_search'] == 27 ))
{
$fSearchDiam = 0.001;
$sSQL = 'SELECT place_id,parent_place_id,30 as rank_search, ST_line_locate_point(linegeo,'.$sPointSQL.') as fraction';