I'm trying to plot the river of a specific area but I don't understand why osmnx
cannot find it in certain places.
I have this code
import osmnx as ox
Sriver = ox.graph_from_place('Providencia, Chile',
# retain_all=False,
# truncate_by_edge=False,
# simplify=True,
custom_filter='["waterway"~"river"]',
# custom_filter='way["waterway"]'
)
But this fails with: Found no graph nodes within the requested polygon
If I query the features from OSM maps, the river is clearly there https://www.openstreetmap.org/query?lat=-33.41919&lon=-70.61062
Should I use other filters? I could not find more information in the docs. Or, is there a way to extract all available filters I can use from an area?
As described in the OSMnx documentation's Getting Started guide:
You said:
... but take a more careful look at the complete error traceback you're getting:
OSMnx is finding the river you're searching for. It does so as a 500m buffered graph then truncates it back down to your desired study area. But because you're requesting that OSMnx automatically simplify the graph topology, and because you have a very trivial spatial geometry as your only result, the simplification step removes all the graph nodes within your study area, leaving only a couple endpoints beyond your study area but within that 500m buffer. So, upon truncating to your study area, it finds no graph nodes remaining within your study boundary itself.
You can solve this problem by 1) not simplifying the graph at all, or 2) simplifying the graph after constructing it. A simple example of both options, plus an illustration of what is happening: