Geocoder icon indicating copy to clipboard operation
Geocoder copied to clipboard

[Photon] Reverse Geocoding with query filters

Open ybert opened this issue 2 years ago • 4 comments

It can be usefull to search precise data from osm when we do reverse geocoding.

For example it can help to search only osm places (locality, city) from a location (latitude, longitude)

ybert avatar Jul 20 '23 17:07 ybert

Ok, I undersand your position. Actually it is the only way to use reverse geocoding with photon and have specific result types.

I will see if I have time to propose a PR for osm_tag on the Photon repository.

ybert avatar Jul 21 '23 10:07 ybert

Hello @jbelien,

My PR has just been merged in Photon master branch.

Can I implement geocoding and reverse with osm tags here or should I wait a tagged version in photon ?

ybert avatar Jul 27 '23 15:07 ybert

https://github.com/komoot/photon/pull/742 has just been merged in Photon master branch.

Awesome work! 👍

Can I implement geocoding and reverse with osm tags here or should I wait a tagged version in photon ?

Of course, you can definitely already update this PR (or close this PR and open a new one if you prefer).

jbelien avatar Jul 27 '23 15:07 jbelien

I just added osm tag feature for both geocode and reverse queries.

You can easily combine multiple osm tag filters like this :

$provider = new Geocoder\Provider\Photon\Photon($httpClient, 'https://your-photon-root-url');
$reverseQuery = \Geocoder\Query\GeocodeQuery::create('Paris')
    ->withData('osm_tag', ['tourism', ':!museum'])
    ->withLimit(5);
// Here we get 5 tourism results in Paris which are not museums
$results = $provider->reverseQuery($reverseQuery);

If it is ok for you I think we can safely release it as the feature has been released on Photon here https://github.com/komoot/photon/releases/tag/0.4.3

ybert avatar Jul 31 '23 14:07 ybert