worldbank / GOSTnets

Convenience wrapper for networkx analysis using geospatial information, focusing on OSM
https://worldbank.github.io/GOSTnets/
MIT License
21 stars 15 forks source link

Advanced Snapping #24

Open d3netxer opened 3 years ago

d3netxer commented 3 years ago

Currently POIs (origins and destinations) are snapped to the graph using pandana snap. This snaps the POI to the nearest node in the graph. This is not ideal when the nodes in the graph are far away, but a part of the line is close. Salting the graph adds more nodes to the graph and increases the likelihood of snapping to a closer nearby node in the graph.

Ideally, you would like to snap the POI to the nearest point on the line in the graph nearest to the POI. This is possible, and described beautifully in this blog post: https://towardsdatascience.com/connecting-pois-to-a-road-network-358a81447944

I have adapted the code for GOSTnets : )

It runs slower than pandana snap, so pandana snap may still be useful to trade accuracy for speed.

Pull request incoming

d3netxer commented 3 years ago

pull request #25

d3netxer commented 3 years ago

For future work a further improvement would be fetching reasonable kNN edges from different directions of the Point as mentioned in the blog post