Creating a distance matrix for the given locations

The Google Maps JavaScript API carries some interesting and particularly helpful properties, one of them being the Distance Matrix Service. Using this service, you can compute the travel time and distance between multiple origins and destination locations.

This is especially useful when you want to have a one-to-one report of your travel nodes, be it a delivery business or only a summertime holiday. This service gives you the travel time and distances within your choice of travel mode (driving, walking, and cycling); you can see the results oriented for each origin and destination.

It is worth noting that the output of this service cannot be mapped onto the base maps; you can have the information ...

Get Google Maps JavaScript API Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.