replace NearPoint with a more generic context object

The NearPoint is actually common to all SearchDescriptions
and there is other context data as well. like viewbox, that
needs to be available to the search object but is common.
This commit is contained in:
Sarah Hoffmann
2017-10-08 21:23:31 +02:00
parent 614a6ab861
commit 30511fd3ab
6 changed files with 194 additions and 220 deletions

View File

@@ -66,15 +66,22 @@ class ReverseGeocode
);
}
public function lookup($fLat, $fLon, $bDoInterpolation = true)
{
return $this->lookupPoint(
'ST_SetSRID(ST_Point('.$fLon.','.$fLat.'),4326)',
$bDoInterpolation
);
}
/* lookup()
* returns { place_id =>, type => '(osm|tiger)' }
* fails if no place was found
*/
public function lookup($fLat, $fLon, $bDoInterpolation = true)
public function lookupPoint($sPointSQL, $bDoInterpolation = true)
{
$sPointSQL = 'ST_SetSRID(ST_Point('.$fLon.','.$fLat.'),4326)';
$iMaxRank = $this->iMaxRank;
// Find the nearest point