Google Directions Matrix Api
Click the select a project button then select the same project you set up for the maps javascript api and click open.
Google directions matrix api. I recommend using the google maps distance matrix api for this purpose. The directions api is a service that calculates directions between locations. To learn more see get started with google maps platform. Specify these by value or by using the constant s name.
How usage and billing work under the pay as you go model. Chicago il or darwin nt australia. To use the directions api you must include an api key with all api requests and you must enable billing on each of your projects. The google maps platform apis are billed by sku.
With the directions api you can. The distance matrix api is a service that provides travel distance and time for a matrix of origins and destinations. The distance matrix api is unfortunately not free. To view or change daily billable limits for the distance matrix api do the following.
Go to the distance matrix api quotas page in the google cloud platform console. Search for directions for several modes of transportation including transit driving walking or cycling. The api returns information based on the recommended route between start and. From the list of apis on the dashboard look for distance matrix api.
From the projects list select a project. In addition to creating a basic map centered in the midwestern united states the code above creates five markers one for each of the cities in our example. If you see the api in the list you re all set. Go to the google cloud platform console.
You can search for directions for several modes of transportation including transit driving walking or cycling. For example ok or google maps distancematrixstatus ok. Specify origins destinations and waypoints as text strings e g. Please consider the billing structure before using the service.
Find your api key in the google cloud console and put it in place of your api key in the code above. The directions api uses a pay as you go pricing model. Distancematrixstatus constants the top level status about the request in general returned by the distancematrixservice upon completion of a distance matrix request.