gboeing / osmnx

OSMnx is a Python package to easily download, model, analyze, and visualize street networks and other geospatial features from OpenStreetMap.
https://osmnx.readthedocs.io
MIT License
4.88k stars 827 forks source link

Feature request - coarse graining a network #338

Closed debsankha closed 4 years ago

debsankha commented 5 years ago

I would like a functionality to convert a larger street network to one with less amount of nodes: Created by merging nodes that are closer than a threshold.

Sample usage would be something like:

>>> G = ox.graph_from_address("Berlin, Germany", distance=1000, distance_type='bbox')
>>> G.number_of_nodes(), G.number_of_edges()
(2417, 6163)
>>> H = ox.simplify.coarse_grain(G, radius=100) # collapses all nodes within 100m radius
>>> H.number_of_nodes(), H.number_of_edges() # H is a smaller graph
(800, 2400)
debsankha commented 5 years ago

I do have a working implementation for this feature, since I needed it for some simulations. I will be happy to submit it as a PR.

gboeing commented 4 years ago

Closed by #339

PratipRana commented 4 years ago

@debsankha Hey Deb, how are you? Remember me?