imed eddines
imed eddines

Reputation: 61

How to plot roads on maps between two points based on GeoJSON file?

I want to visualize possible roads between two points, something like google map, I have a GeoJSON file that contains the roads network, is it possible or is there any algorithm to plot only roads between two points?

-This is what I have done, and I want the line to be according to the roads.

enter image description here

Upvotes: 3

Views: 989

Answers (1)

Michael Entin
Michael Entin

Reputation: 7764

What platform do you use? For PostgreSQL / PostGIS there is PG Routing extension that you can use. It can find shortest path between vertices of road network. So you would need to find the vertices of the road network closest to the start and destination, and then find a route between them. There are plenty of guides, e.g. https://anitagraser.com/2011/02/07/a-beginners-guide-to-pgrouting/

If you are using raw Python, recreate Dijkstra Shortest Path algorithm.

Upvotes: 1

Related Questions