-
Notifications
You must be signed in to change notification settings - Fork 828
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
save_graph_xml fails if roundabout present #970
Comments
Most of the time the topological sort isn't necessary because the rows are already ordered correctly. We only order them because it's not written anywhere in the OSM docs that they have to be, afaik. But if we assume the first row in the edges table is the first edge, a potential solution for the roundabout issue could look like this:
|
Interesting. Would you like to open a PR to correct this?
Can you remind me again why the rows need to be in a certain order? And what the OSM docs do say about it? That is, what exactly is expected here? |
Also, the NetworkX topological sort function only works on DAGs, which we should expect a real world street network to never be. Accordingly, we'd expect that unfeasible exception every time the function runs. Does it really make sense to have it in our codebase at all? |
The rows need to be in a certain order because that's how OSM defines a way:
I honestly don't recall if I implemented the sorting logic just to conform with that definition or if I actually encountered errors without sorting. You're right about the DAG thing, but the reason why you don't get an unfeasible exception every time is that the workflow for using But also I won't be offended if you'd rather deprecate the method. |
I'm still not grasping something for some reason... The
It currently raises a warning if this happens, so it should be obvious to the end user. |
Oh, yeah it works because the topological sort is only performed one way at a time, not on the whole graph: https://github.com/gboeing/osmnx/blob/main/osmnx/osm_xml.py#L306-L315 |
Ah of course. That's what I was forgetting. I should have just looked back through the code more carefully. |
Given your potential solution earlier, would you like to open a PR? |
Yes, will do! |
Closed by #986 |
See enhancements in #1135 |
Read these instructions carefully. Use the template below and fill out every section. Your issue will be automatically closed if you don't provide all of the information requested in the template, because we need this information to assist you. Before you proceed, review the contributing guidelines in the CONTRIBUTING.md file.
Please don't use the issue tracker to ask "how-to" or usage questions. If asked here, they will be closed automatically. Instead, ask "how-to" and usage questions on StackOverflow. If you installed OSMnx via conda and are experiencing installation problems, please open an issue at its feedstock instead.
Bug reports are for reporting a bug you have found in OSMnx's codebase. First search the open/closed issues and StackOverflow to see if the problem has already been noted. If it hasn't, fill in the bug reporting template below.
Completely fill out the following template.
Problem description
networkx.NetworkXUnfeasible
error was thrown as soon as osmnx tried to perform a topological sort on a table of edges corresponding to a roundabout (https://overpass-turbo.eu/s/1vwy).Environment information
conda list
orpip list
then paste the output between the two "details" tags below)Provide a complete minimal reproducible example
Your example code snippet here must be minimal so it doesn't contain extraneous code or data unrelated to your specific problem and it must be complete so we can independently run it from top to bottom by copying/pasting it into a Python interpreter. That means all imports and all variables must be defined. If you're unsure how to create a good reproducible example, read this guide. Do not post a screenshot of your code or error message: provide it as text.
The text was updated successfully, but these errors were encountered: