We are currently in the process of adopting Graphhopper for a couple of tasks, one of them beeing lookup of postal codes to filter objects based on their location.
I am currently evaluating the usage of Graphhoppers Geocode API, am however struggling with the generic nature of the APIs query parameter. When I query a postal code, sometimes it will show a correct hit, most times though it will consider e.g. a Street in the U.S. as a more accurate result.
Now according to the documentation the API supports different providers, one of them being nominatim, which according to their documentation supports structured queries. Is it possible to pass those through from the Graphhopper to the nominatim-API?
As we use opencage data not only for their own geocoding provider but also for provider=nominatim it is currently not possible to support structured requests:
Nominatim supports some types of structured queries. We do not.
This is intentional, our goal is to keep the service as simple as possible for developers to comprehend and get productive with our service. Please follow the steps laid out in our guide to query formatting.
Thank you for the response and sorry for reopening this ticket, but I do have a follow up question now. We are querying the API with the following parameters:
https://graphhopper.com/api/1/geocode?q=08301&provider=nominatim&countrycode=DE&key=..
The goal is to resolve a location for a german postalcode. It seems as though the ‘08301’ string is not being treated as that, since the API is not returning any hits. Based on my research after a few google searches, this is due to graphhopper preferring city names over postalCodes and possibly trimming leading zeros.
Based on your response and the query formatting guide, I deduce that there is no clean way to accomplish a better result with just a postalCode.
Do you have any recommendations here?
In general we do currently not have a way for structure geocoding requests as the underlying Nominatim setup provided from OpenCage is not supporting this:
Structured Queries
Nominatim supports some types of structured queries. We do not.This is intentional, our goal is to keep the service as simple as possible for developers to comprehend and get productive with our service. Please follow the steps laid out in our guide to query formatting.
See my previous reply about this topic.
However, the photon search engine we use as our default provider has recently added a the possibility to easily use structured queries which we could support in our converter at some point in the future.
There is also a recent change that would allow this for the normal search endpoint in komoot.