0

I'm making a web app that makes what the title says, right now I have my bus stops and routes and I know how to add them to my map as markers and polylines respectively, I can also get the users current position and add a marker where they click on the map.

Now I need to know how to return the fastest route to get from current location to the desired destination, like google maps does, and I have no clue how to. Any help would be greatly appreciated.

4
  • Look up the Dijkstra algorithm Commented Jul 2, 2023 at 1:21
  • I would suggest to load data to Postgres+PostGIS, then use PGR module to perform shortest path computation- there are different algorithms implemented like Dijkstra, A*, …. Specifically, if you want to use data from OSM, it would be much easier to load it in Postgres and use PostGIS functionalities. Commented Jul 2, 2023 at 1:53
  • you can also use open route services - to compute shortest path from their data and using their APIs: github.com/GIScience/openrouteservice-py Commented Jul 2, 2023 at 2:43
  • You will have to account for schedules, not just a simple path. This is quite involved, and I'd recommend using an API that accounts for the complexity, not building (and maintaining! schedules are dynamic) your own. Commented Jul 3, 2023 at 1:10

0

Browse other questions tagged or ask your own question.