Search code examples
google-apidistancetraveling-salesmangoogle-distancematrix-apiosrm

Where can I get large road distance matrix from?


I need to get real distance matrix (taking roads on board) between 320 locations. I have the information about theirs geographic coordinates.

I'd like to use Google Distance Matrix Api but there are limits making my task impossible or if I divided matrix on small pieces it would take a long time.

I'm thinking about OSRM and my own routing server but it requires much effort.

What do you think about Google? Have any experience with OSRM. Or maybe you can recommend something else.


Solution

  • OSRM matrix is very quick (seconds for 300 locations) but it provides driving times only. To get distances you'll have to call regular route service for each pair of coordinates (hours).

    Other self hosted alternatives are GraphHopper (no matrix, repeated calls to route) and Valhalla (distance and time matrix).

    If you have to prepare the matrix just once a pay-per-use matrix service could be a better option. Both GraphHopper and Valhalla's Mapzen provide one, check if your matrix size is supported and what the cost is.