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

setRouteIndex not working in google map direction JS api v3

according to this, directionRenderer object's method setRouteIndex() should Set the (zero-based) index of the route in the DirectionsResult object to render. here is what i have done: directionsService.route(request, function(response, status) { …
2
votes
1 answer

How to write a GPS routing application wthi Google Maps API

I'm going to write a GPS routing application using Google APIs. So far I know that I have to use Google Directions service to obtain and show the path between two points on a map. But How can I show a, for example, rectangle that represents the…
s4eed
  • 7,173
  • 9
  • 67
  • 104
2
votes
1 answer

Google Geolocation and Direction API

How do you combine both Google Geolocation and Direction API such that when you click the geolocation marker and any one of the markers (of which I hardcoded the coordinates), it will show the direction betweeen both of them. Geolocation…
2
votes
2 answers

Google direction api request invalid in ios5

Here is my request: https://maps.googleapis.com/maps/api/directions/json?origin=49.276951,-123.128559&destination=49.277874,-122.912404&mode=transit&sensor=false The result is: { "routes" : [], "status" : "INVALID_REQUEST" } It worked before,…
Tomy
  • 31
  • 4
2
votes
4 answers

Is there any way to wait until the DirectionsService returns results?

I have a problem with the Google DirectionsService. I know it's asynchronous and that is the cause of my troubles. I'd like to wait until the DirectionsService returns a result instead of executing code without an answer. Here is a sample: function…
Martus0
  • 667
  • 1
  • 10
  • 16
1
vote
2 answers

Display Google Map Direction instructions in different languages

I am using Google Map service. Now I integrated Google Map Direction into my application, but all direction instructions are English. Anyone know the way to translate it into other languages? (e.g Vietnamese). You can see the site: maps.google.com,…
Leo Lerdorf
  • 1,304
  • 4
  • 15
  • 19
1
vote
1 answer

How to resolve getting an unambiguous error message from Node.js Client for Google Maps Services

I am trying to use the Google Maps Directions API in my Node.js application to get optimized routes between multiple waypoints. I haven't been able to make successful requests and receive responses using the API, and the problem is I can't debug the…
liryc
  • 11
  • 3
1
vote
0 answers

Unable to show polyline in Google Maps Directions using react-google-maps-api

I am trying to show directions on google map. I am getting correct directions data but direction renderer only showing origin and destination markers but polyline or precisely route is missing between them. I am using react google maps api…
1
vote
1 answer

Google Maps API - Setting the Center on a Mobile Device

On a Mobile device we which to set the center of the map to the first coordinate, not the user's actual location as it does now. So, for example: http://maps.google.com/maps?saddr=49.34593,-123.1807&daddr=49.35037,-123.1749 Should center on…
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
1
vote
1 answer

Google Directions API distance calculation from VBA

I used a tutorial to automatically calculate travel distance using Google Directions API, based on addresses I enter in Excel. I succesfully created an API key and I used a tutorial page that showed two functions in VBA, one for Time and one for…
1
vote
3 answers

track distance and time based on my track details

I am working on gps tracking in android to track the user location and provide the feature to record the track.I am able to draw path now i want to calculate the track distance and time with that like suppose user start tracking record and move to…
Pratik
  • 30,639
  • 18
  • 84
  • 159
1
vote
0 answers

How to remove travelled path from google map in Swift

I write below code for removing the travelled path by a user but it will not worked as expected some time it will remove correctly and some time not. I observe one thing in this case after debugging a lot that is when we call direction API and…
1
vote
1 answer

DirectionsApiRequest not working below from SDK 26 Android phone

I am using DirectionsApiRequest to get direction information from google it work fine from SDK 26 to above android phone.But it did not give any result or error on android phone below to SDK 26. DirectionsApiRequest directionsApiRequest = new…
Mohsin Tariq
  • 63
  • 2
  • 3
  • 10
1
vote
0 answers

How to debug Google Directions API error?

I am developing an app in flutter using google maps. I have enabled google directions API to get the route between origin and destination. My app does not show any error but at the same time, it does not display the route. The google directions API…
1
vote
0 answers

React-Native Google direction api not working

I am developing a mobile application, my aim is to show the distance between two people on the map, I use the Google direction api for this, but there is a problem. The distance line between the two locations is not visible. I leave my map.js…