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

[Feature Request] Lookup by id (GoogleMapsProvider, Nominatim) #942

Open
franzwilding opened this issue Apr 10, 2019 · 6 comments
Open

[Feature Request] Lookup by id (GoogleMapsProvider, Nominatim) #942

franzwilding opened this issue Apr 10, 2019 · 6 comments

Comments

@franzwilding
Copy link

@franzwilding franzwilding commented Apr 10, 2019

First of all, thanks for this great php package!

I have a feature request for getting address information by id instead of doing a full search again. I think many applications will store part of the geocoding response and eventually will re-fetch information for the stored part.

At the moment, with GoogleMapsProvider and NominatimProvider you can only do a reverse lookup by lat/lng or re-do the query. However both of the endpoints have a dedicated API for lookup (for google maps this even is the preferred way, because it will not count as a request as far as I know).

For OpenStreetMap it looks like this: https://nominatim.openstreetmap.org/lookup?osm_ids=NXXXXX.

It would be great if the providers would have a lookup method for this.
An even better solution would be to extend the provider Interface (or have a 2nd interface "LookupAwareProvider" with a lookup action or the GeocodeQuery object with an id property and maybe also the Location interface.

If a provider defines an id for a location, it could be used for a lookup call.

I know, that I can easily achieve this by creating my own provider, however, if this feature is interesting for you, we could discus an solution and I could provide a PR for this.

@jbelien
Copy link
Member

@jbelien jbelien commented Apr 12, 2019

Hello @franzwilding ,

That's indeed (IMHO) a good idea !
I think we could add it to our Geocoder Interface rather easily.

What do you think about this @willdurand @Nyholm ?


Documentation:

@franzwilding
Copy link
Author

@franzwilding franzwilding commented Apr 12, 2019

Hey @jbelien,

I think an even better solution would be to extend the Gecoder Interface with an id-aware-geocoder interface, because some geocoders will not support an id, I guess?

@jbelien
Copy link
Member

@jbelien jbelien commented Apr 12, 2019

You're right but that's not an issue.

Some providers do not support reverse geocoding either (have a look at AlgoliaPlaces for instance).
For consistency, I would add a lookup function to the standard Geocoder interace.

@franzwilding
Copy link
Author

@franzwilding franzwilding commented Apr 16, 2019

Ok cool. I will try to find time to create a PR for this!

@franzwilding
Copy link
Author

@franzwilding franzwilding commented Jul 2, 2019

@jbelien I finally found some time and implemented a first draft of the lookup action. in #979. Once jenkins runs, we can see if this is a good solution

@jbelien
Copy link
Member

@jbelien jbelien commented Jul 3, 2019

Thanks a lot @franzwilding ! 👍
I'll have a look at it as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.