Questions tagged [google-directions-api]

The Directions API is a service that calculates directions between locations using an HTTP request. It is also available as part of the client-side Maps JavaScript API, or for server-side use with the Java Client, Python Client, Go Client and Node.js Client for Google Maps Services.

With the Directions API, you can:

  • Search for directions for several modes of transportation, including transit, driving, walking or cycling.
  • Return multi-part directions using a series of waypoints.
  • Specify origins, destinations, and waypoints as text strings (e.g. "Chicago, IL" or "Darwin, NT, Australia"), or as latitude/longitude coordinates, or as place IDs.

The API returns the most efficient routes when calculating directions. Travel time is the primary factor optimized, but the API may also take into account other factors such as distance, number of turns and many more when deciding which route is the most efficient.

Note: This service is not designed to respond in real time to user input. For dynamic directions calculations (for example, within a user interface element), consult the documentation for the Maps JavaScript API Directions Service.

This service is also available as part of the client-side Maps JavaScript API, or for server-side use with the Java Client, Python Client, Go Client and Node.js Client for Google Maps Services.

523 questions
2
votes
1 answer

Get distance from Google Cloud Maps Directions API

I'm trying to get the distance between bus stops to get a rough estimate of when the bus is coming. I know there are apps and services that do this, but I want to do it myself. I got the result object, but don't know how to get the distance. Debug…
Ken Shibata
  • 71
  • 1
  • 9
2
votes
0 answers

Get position of Longitude Latitude coordinates in array of coordinates

I am trying to calculate the distance from a specific point along a route that has waypoints using Google Maps API. I am able to calculate the distance of the whole route by providing the Long/Lat coordinates of each waypoint, and the origin and…
Ronny vdb
  • 2,324
  • 5
  • 32
  • 74
2
votes
1 answer

“This API project is not authorized to use this API” using Google-Directions-Android

I'm building an app using Google-Directions-Android (https://github.com/jd-alexander/Google-Directions-Android). I'm using the API Key in the same App for maps without problems, but when I try to use the following Routing routing = new…
2
votes
1 answer

Route won't draw on map with "Google-Directions-Android" library

I am using the Google-Directions-Android Library (while following this example).I have followed the example above and no route was drawn on the map for me - no errors were thrown either and I don't know what I did wrong. My map code (the code that…
Tamir Abutbul
  • 7,301
  • 7
  • 25
  • 53
2
votes
1 answer

Error: cannot find symbol class Builder (using GeoApiContext)

I am trying to execute Direction API from the code below: GeoApiContext context = new GeoApiContext.Builder() .apiKey("MyAPIKey") .build(); and I receive the following error: error: cannot find symbol class Builder I am…
2Mass HPMS
  • 33
  • 6
2
votes
1 answer

Change the colors of multiple polylines by OnPolylineClickListener

I have multiple polylines in google map. It has to change its color to blue when user click on each polyline and others should be grey. I have added polylines to a list as follows... polylinePaths = new…
2
votes
1 answer

Directions API Request Denied Android Client

I am trying to make a request to directions api from android. I have constructed my request url like…
Andromeda
  • 230
  • 1
  • 7
  • 22
2
votes
1 answer

Supply API key to avoid Hit Limit error from Maps Service in Apps Script

I have a Google Sheet where we are fetching the driving distance between two Lat/Lng via the Maps Service. The function below works, but the matrix is 4,500 cells, so I'm getting the "Hit Limit" error. How can I supply my paid account's API key…
2
votes
0 answers

Google map direction API shows different number of alternative routes during different searches

when i am finding the alternative paths between two places using google API, i am getting different results. For the same origin and destination i get different number of routes between them and the alternative path also differs for different…
2
votes
1 answer

Google map in ios direction route not work correctly in swift

I'm trying to draw direction route for two locations.I use this function to route.The problem is that it dosnt work for locations that were drawn before.even I close the app and run again but it dosnt work for previous coordinates as soon as I…
maral
  • 259
  • 4
  • 18
2
votes
2 answers

Is it possible to avoid tolls in Google Maps URLs latest version?

In the old Maps URLs API, you could add "&dirflg=dt" in the URL. Here's an example URL using the new API taken from Google's official pages…
2
votes
1 answer

Unhandled promise rejection: TypeError: undefined is not a function evaluating 'departureloc.map' occurs when mapping for setState in react native

I am successful on getting through the JSON response from Google Directions as i am trying to get to the transit information from the json response which is initially looks like this when successful. Object { "geocoded_waypoints": Array [ …
johnobc
  • 571
  • 3
  • 11
  • 25
2
votes
2 answers

How to show directions in angular google maps from current location

I am using angular google maps in my angular Web App. I want to show directions from user's current location to a marker containing sub locations. In my web app the marker has multiple sub locations identified using lat and lng. So when user clicks…
Anil
  • 1,748
  • 8
  • 32
  • 67
2
votes
1 answer

How does the Google Maps Directions API differentiate interline transfers?

I am building an android transit app for real-time bus/train arrivals, I would also like to add directions for users using the google maps directions API. My transportation agency (TriMet) uses interline / thru-route transfers. Interline transfers…
Roman
  • 774
  • 7
  • 12
2
votes
1 answer

Googleway R Alternative routes

I'm using the google_directions() function to generate driving routes between two coordinates which are generated on clicking at different points in a leaflet map.I would like to show a few possible routes, instead of just one. Setting alternatives…
Agalloch
  • 23
  • 2