For distance calculate each route point given by JSONXML data as for displacement there is a built-in solution using Spherical class. Add the First Point To start measuring distance open Google Maps then long-press your first target point to drop a pin on the location. The Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations.
If you want to measure the distance between multiple points simply click the next point on the map.
You are given two coordinates x1 y1 and x2 y2 of a two-dimensional graph. Add the first point. The API returns information based on the recommended route between start and. On your computer open Google Maps.