You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[102], line 1
----> 1 ox.geocoder.geocode_to_gdf("R6195356", by_osmid=True)
File ~/.virtualenvs/p311/lib/python3.11/site-packages/osmnx/geocoder.py:123, in geocode_to_gdf(query, which_result, by_osmid, buffer_dist)
121 gdf = gpd.GeoDataFrame()
122 for q, wr in zip(query, which_result):
--> 123 gdf = pd.concat([gdf, _geocode_query_to_gdf(q, wr, by_osmid)])
125 # reset GeoDataFrame index and set its CRS
126 gdf = gdf.reset_index(drop=True)
File ~/.virtualenvs/p311/lib/python3.11/site-packages/osmnx/geocoder.py:172, in _geocode_query_to_gdf(query, which_result, by_osmid)
169 # choose the right result from the JSON response
170 if not results:
171 # if no results were returned, raise error
--> 172 raise ValueError(f"Nominatim geocoder returned 0 results for query {query!r}")
174 elif by_osmid:
175 # if searching by OSM ID, always take the first (ie, only) result
176 result = results[0]
ValueError: Nominatim geocoder returned 0 results for query 'R6195356'
If you turn on ox.settings.log_console = True you can see exactly what server requests OSMnx is making. In your case, it's requesting https://nominatim.openstreetmap.org/lookup?format=json&polygon_geojson=1&osm_ids=R6195356 If you click the link, you can see that it indeed returns no results from Nominatim. So OSMnx is handling it correctly... this relation doesn't exist in Nominatim.
However, as you note this relation does exist on OpenStreetMap, so you may want to request a fix upstream---either at Nominatim or OpenStreetMap, depending on where exactly the data discontinuity is occurring.
Contributing guidelines
Documentation
Existing issues
What operating system and Python version are you using?
Arch Linux
What OSMnx version are you using?
1.5.0
Environment packages and versions
.
How did you install OSMnx?
Pip
Problem description
While trunig to fetch:
https://www.openstreetmap.org/relation/6195356
This code:
Raises:
This overpass turbo does not return anything:
But this does:
Complete minimal reproducible example
The text was updated successfully, but these errors were encountered: