Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a Distance Matrix with the computation being made offline on my server

I am looking to get an approximation of the travel distance and time between several locations.

Ideally, I want to be able to send in the GPS coordinates of the locations, use the data of OpenStreetMap, and get as an output a distance matrix with the given locations, all of this would be done offline on my AWS server. (Using PHP or C++ would be good)

I am really new to using OpenStreetMap. I have just downloaded the ile-de-france.osm.pbf, which is the map for a region of France.

I have no clue where to start. I am not even sure if it is simple to do it. Can anyone point me in the right direction? And If OpenStreetMap is not the best solution for getting a distance matrix offline, then what is?

like image 809
Guy Daher Avatar asked Mar 18 '23 22:03

Guy Daher


2 Answers

For calculating traveling distances you have to install a router, too. Choose one of the available online routers (many of them can be installed locally and used offline, too) or offline routers. Good choices are OSRM, GraphHopper and gosmore.

like image 130
scai Avatar answered Mar 30 '23 00:03

scai


OSRM has a distance matrix call, but it's currently limited to a certain quantity of locations. I've built a script to make large distance matrices with a local OSRM server (it's really simple to compile on Ubuntu). Here it is https://github.com/sabas/OSRMdistance I've computed square matrices of more than 300 locations...

like image 42
sabas Avatar answered Mar 30 '23 01:03

sabas