Google Maps Api Directions Example. This example demonstrates the use of the DirectionsService object to fetch directions between different cities. Create a map and center it on Manhattan.
The API is thoroughly documented and most of the parts I used just worked on the first try. If you want to look at different options for using an API via JSON REST see Andrew Brogdons Medium post for a range of options for working with JSON REST APIs. You can calculate directions using a variety of methods of transportation by using the DirectionsService object.
Create a map and center it on Manhattan.
Also see the Maps JavaScript API Reference. Const map new googlemapsMapdocumentgetElementByIdmap zoom. Im trying to work out how to use the Google Maps Directions Demo to get the distance from the successful directions. The project is an example app for iOS to populate google map with placemarks waypoints and draw polyline joining the waypoints.