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
1
vote
0 answers

How can I show multiple gates/entrances using Google Places/Directions API?

We are using Places API to show predicted addresses (Swift language). screenshot here Now we have to display all entrances\gates of the places (if they are available) like in this app Is it possible to make it in Google PlacesAPI or we need to use…
1
vote
0 answers

Google Maps Direction API Android Studio - Adding an additional waypoint in between of the route

I am working on my project trying to add a waypoint in between of the route that I generated from my Location to Destination, short (point A to point B). I am not able to do this due to only a singular marker added to the calculateDirections()…
1
vote
0 answers

Empty body when trying to get direction between two points using Retrofit

I'm using the following code to get the direction between two points on Google Maps: Callback directionCallback = new Callback() { @Override public void onResponse(@NonNull Call call, @NonNull…
Alex Mamo
  • 130,605
  • 17
  • 163
  • 193
1
vote
0 answers

Google maps API Swift; Nil maneuver response

I am trying to get the maneuver data for the given route from Google Maps' API. Running the code gives me nil values. Here is the code I am running to get the maneuver data: func getRouteSteps(source: CLLocationCoordinate2D,destination:…
WKD
  • 11
  • 4
1
vote
1 answer

Computing travel time in R with gmapsdistance

I need to find the travel time between a given point for which I know latitude and longitude values and a series of points contained in the column of a dataframe (for which I also know the longitude and the latitude). I used the following code…
vsh1996
  • 9
  • 2
1
vote
1 answer

I am using an unrestricted api key for Google Maps SDK for iOS with my iOS Xcode project after having created a new key and deleting the old key

I am using an unrestricted api key for Google Maps SDK for iOS with my iOS Xcode project after having created a new key and deleting the old key, but my request is denied. It worked before when I used the first key. Here is the error…
daniel
  • 1,446
  • 3
  • 29
  • 65
1
vote
1 answer

Can't enable Maps SDK for Android in cloud console

I'm facing this issue while enabling the Maps SDK for Android in cloud console. https://console.cloud.google.com/ It will throw the following errors; screenshot attached. I got the error that I can't complete this transaction. After that, when I…
1
vote
1 answer

Geolocation works in the browser but shows PositionError on device

I'm trying to display the route, currentlocation from another location, in the browser, works but when I try in the phone it seems doesn't work. I mean the center map doest work and the routes don't display sorry for my bad English:( ngOnInit()…
1
vote
0 answers

using multiple waypoints in google directions service

I have following code for the functionality in my site to calculate distance between a pickup address, a drop-off address and one waypoint (optional). if ( Google_AutoComplete_Country != 'ALL_COUNTRIES' ) { var options = { …
1
vote
0 answers

How far in the future does the Google Directions API take into account of current traffic conditions'

I'm building a mode choice model using Car and Public Transport journey times from Google Maps, and want to see how traffic impacts Car journey times on a daily and hourly basis. I understand that the "duration_in_traffic" parameter will return a…
James uri
  • 11
  • 1
1
vote
1 answer

How to display distance and location from JsonObject in textview in android?

I am having a problem at displaying the distance and location get from JsonObject return from Google. I am able to get the location and route between two points but I am unable to display the distance and location in TextView. I am able to display…
Liew Syet Chau
  • 143
  • 3
  • 14
1
vote
1 answer

How to get duration and distance in JSON object return by Google?

I want to get the distance and duration for example in this https://maps.googleapis.com/maps/api/directions/json?key=API_Key&sensor=true&language=en&origin=6.035507,116.1213559&destination=5.9699316,116.0665816. I have already get the route in…
Liew Syet Chau
  • 143
  • 3
  • 14
1
vote
0 answers

AsyncTask not getting executed more than one

i am initiating direction api to draw polyline,calling asyncTask in oncreate, but its not getting called second time onwords even opening activity again and again. after removing app from recent apps and opening it again works for a single time.here…
Ashish Patel
  • 304
  • 1
  • 3
  • 11
1
vote
1 answer

Google Direction API and Google Maps App showing different routes for same destination

I am working on an app in which I have to show shortest route. I am using Google Direction API but the result is different from Google Maps app for same destination and travel…