https://medium.com/walmartglobaltech/finding-and-plotting-optimal-route-using-open-source-api-in-python-cdcda596996c
·
Published in
·
6 min read
·
Sep 12, 2023
While working with geospatial data, many a times we encounter cases where we need to determine the optimal route between a start and end point (latitude and longitude). For example, while trying to understand where to open a new restaurant on a highway or which fuel station will serve most routes, we need to understand the most travelled routes between big cities. While in many use cases, only the drive distance between a set of points is needed, at times we require the details of the entire route with the ability to plot them on the map. This can be done using available Map APIs however those are usually not free. We have open source libraries in python that serve the same purpose like NetworkX and OSMnx, but as the distance between source and destination increases or we move across state / country boundaries, the API tends to take a very long time or crash. Here we propose an open source solution that can give route details even over long distances by combining the capabilities of these two APIs — OSRM (Open Source Routing Machine) & Open Street Map.
API format