This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Can’t find a state anymore in nominatim (there is a city with the same name)

1

I used to find objects inside the São Paulo State by simply using "São Paulo" in nominatim. Likewise, objcets inside the city of São Paulo could be found by using "SP".

Now it seems that something has changed and, no matter what kind of combination of "SP" and "São Paulo" I use, they all return the city as the first result (and this also affects overpass queries).

Some examples that I did try without success:

What do I need to do to differentiate if I want to search for the city or for the State, when both have the same name, please?

asked 27 Jul '19, 03:39

naoliv's gravatar image

naoliv
60071019
accept rate: 37%


One Answer:

1

Both have the same name and short_name. Which of state or the city are more relevant as first result is debatable, both are in the top 5 results. Since the city is inside the state there is no phrase you can add to the Nominatim query to make it prefer one or the other, Nominatim doesn't have tag filters like some other search engine do. Same issue with many state capitals around the world: Washington D.C. (both city and district), Berlin (city and state), Vienna. Does Overpass allow setting the osm_id instead?

answered 27 Jul '19, 03:59

mtmail's gravatar image

mtmail
4.8k1574
accept rate: 27%

Indeed, we can search/filter by the area (relation) id https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#By_area_.28area.29 For my case https://overpass-turbo.eu/s/LpZ Thanks!

(08 Aug '19, 20:01) naoliv

Source code available on GitHub .