I am trying to use the Nominatim API to geocode cities, with simple HTTP GET requests. I want to receive a specific number of possible matches, when available. The documentation indicates this is possible by using the "limit" parameter:
This works as expected for most queries. For example, if I request limit=2, I get the top 2 results and if I request limit=3, I get the top 3 results. But the limit parameter behaves erratically for some queries. For example, with Sonoma California:
If 2 results are available when I request limit=3, why didn't I get 2 results when I requested limit=2? As another example, with Petaluma California:
Why am I inconsistently not receiving as many results as I am requesting, and how can I make sure to receive the exact number I request? asked 28 Sep '16, 06:03 gboeing |
Sometimes you have several objects in OSM identifying the same place or object in reality. The simplest case is a street being split in many different OSM ways due to different characteristics. Nominatim will attempt to detect such duplicates and only return one match; this is controlled by the In your "Sonoma" case, when limit=2 and dedupe=0 are set, Nominatim returns the ways 33162431 and 33162426 (it should return http://www.openstreetmap.org/relation/113172 instead and I don't know why it doesn't). answered 28 Sep '16, 07:21 Frederik Ramm ♦ Thanks. Yes the dedupe parameter used in conjunction with the limit parameter does appear to give me the number of results I request, each time. However, like you mentioned in the last sentence that is an odd result.
(06 Oct '16, 18:48)
gboeing
|
cross-posted: https://gis.stackexchange.com/questions/212307/openstreetmap-nominatim-api-limit-parameter-behaving-erratically-returns-incons