Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Photon] Reverse Geocoding with query filters #1195

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ybert
Copy link
Contributor

@ybert ybert commented Jul 20, 2023

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)

Copy link
Member

@jbelien jbelien left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ybert ,

Thanks a lot for your contribution.
I've looked a bit for documentation about query_string_filter but couldn't find anything. After a bit more research, I've found komoot/photon#703 (comment).

I see you've commented this issue but it seems that that filter was not really intended to be implemented and might be removed.

In theory we have the query_string_filter parameter for reverse which got sneaked in in komoot/photon#254. It should be able to do arbitrary filtering including the one you want. However, this was never documented and I very much prefer to let it die quietly and implement the tag filters from search instead.

I would prefer not to implement this feature in our provider (because we will have to remove it at some point which will create a breaking change) and instead implement osm_tag for the search (and the reverse geocoding once implemented).

@ybert
Copy link
Contributor Author

ybert commented Jul 21, 2023

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
Copy link
Contributor Author

ybert commented Jul 27, 2023

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 ?

@jbelien
Copy link
Member

jbelien commented Jul 27, 2023

komoot/photon#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).

@ybert ybert force-pushed the photon-reverse-with-osm-filters branch from 97511a5 to 71a1a8e Compare July 31, 2023 12:33
@ybert
Copy link
Contributor Author

ybert commented Jul 31, 2023

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 ybert requested a review from jbelien August 2, 2023 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants