-
Notifications
You must be signed in to change notification settings - Fork 830
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
Support loading and/or merging multiple networks #1140
Comments
Thanks for this suggestion. The OSMnx project follows three principles when adding new functionality: 1) it is useful for a broad set of users, 2) it generalizes well, and 3) it is not trivially easy for users to implement themselves. Your proposal would offer some powerful functionality, but I believe it's outside the scope of the project. Most users merging multiple networks can do so in one line of code with |
Thanks for getting back!
That was indeed my first approach. But then I noticed that no edges or nodes were removed. After an intense debugging session, I figured it was because I wanted to merge after simplifications. That messes up all the node and edge IDs, especially after consolidating intersections. If I find a good approach for differential simplification I think is worth sharing, I will do somewhere with an example. |
Having slept on it I think the proper location to tackle this is at the simplification stage. So, you would get your networks, add an attribute to them to recognize them (i.e. A good, broadly useful way to integrate this might be by adding a simplify_graph(G, filter_attrs={"network": "The Hague"}) in which Would you be open for something like this? |
The proposed resolution discussed in #1127 would allow users to retain nodes in a simplified graph based on the attributes of the node or its incident edges. I suspect that resolution will probably help in use cases similar to this. And for more complicated use cases, a customized rather than built-in solution is probably appropriate. |
It could be indeed integrated in that one. I think here I propose it a bit broader: Both I think some open questions are:
|
Contributing guidelines
Documentation
Existing issues
What problem does your feature proposal solve?
When working with OpenStreetMap (OSM) data for urban planning or transportation analysis, it is often necessary to work with specific areas at different levels of detail or to combine data from multiple regions into a single network. Currently, merging two or more networks in OSMnx requires manual effort and a good understanding of both OSMnx and NetworkX. This process can be unintuitive and time-consuming, especially for users who need to efficiently merge networks with overlapping areas while ensuring that duplicates (nodes and edges with the same OSMIDs) are properly handled.
What is your proposed solution?
I propose adding built-in functionality to OSMnx that allows users to load and merge two or more graphs/networks directly within the library. This functionality should:
What alternatives have you considered?
Currently, the workaround involves manually using NetworkX functions to combine the graphs and then iterating over the combined graph to remove duplicates. This process is not only cumbersome but also prone to errors, especially for users not deeply familiar with the intricacies of NetworkX or the specific data structure conventions used by OSMnx.
Additional context
When working with OpenStreetMap (OSM) data for urban planning or transportation analysis, it A minimal working example of the current approach to merging two networks, highlighting the complexity and manual steps involved:
The text was updated successfully, but these errors were encountered: