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

Optimize path with waypoints based on least distance google directions android

I was using google directions api to get the route between two latlng points and plotting it on a google map. The issue is that i can optimize the route when adding waypoints but i can't control the optimization criteria. The code i am using for…
Maaz Asif
  • 77
  • 6
2
votes
2 answers

Direction API return only one route when specify waypoints

I'm using Direction API to display the routes between source and destination. I formed the URL like…
Thamim
  • 328
  • 3
  • 14
2
votes
0 answers

Showing fastest ETA in REAL TIME

I want to show the ETA(Estimated time of arrival) in real time,Which means as the vehicle moves i need to get the ETA and distance similar to OLA.I can do this using google directions api,But my problem is usage limit of the api. Please let me know…
Abhishek
  • 86
  • 6
2
votes
1 answer

How to access object in parsed nested JSON in Google Apps Script

Broad spectrum apology, to start off with, for any mistakes relating to being a n00b when it comes to code, js, Google Apps Script and indeed stackoverflow.com. I am trying to extract the polyline from an API call to Google Maps' Directions API.…
2
votes
1 answer

Incorrect path using encoded polyline from Google Directions API in Static Maps

I'm trying to use an encoded polyline from Google's Direction API and display it in a Google Static Map image. When I use the encoded polyline in the Static Map the path is displayed incorrectly - it starts in the correct place, and has the correct…
2
votes
2 answers

How should we show path between two latitudes & longitudes in google maps using Swift

Here, i have source latitude & longitude in the same way i also have destination latitude & longitude Now, i want to show the path between these two lat & long's sourcelatitude = 12.9077869892472 sourcelongitude =…
Bhanuteja
  • 771
  • 2
  • 8
  • 18
2
votes
3 answers

API - Travel time based on arrival time

I want to find a travel time (including traffic) between two addresses. Inputs - origin, destination, arrival time, mode of transportation, traffic model (pessimistic, optimistic, best guess) Output - Travel time It looks like the Google Distance…
2
votes
1 answer

CORS request is not working on google directions API

Every time I try to get data from the directions API, I get No 'Access-Control-Allow-Origin' header is present on the requested resource. I've tried to do the same request to the geocode API and it works. This is the code that I'm using: var xhr…
Razvan
  • 303
  • 1
  • 4
  • 11
2
votes
4 answers

Is it possible to call a Google API and get the map image and save the image in somewhere

I am currently working on sending a google map image in an html email . Currently I am using static-maps-api to achieve my task . i will call the static maps api and set the image URL as src In an image tag .
2
votes
1 answer

Is there a way to avoid a specific road or coordinate in Google Directions?

The API has a parameter for waypoints in order for The API to calculate the route ang pass through the specified waypoint/s. Is there any way where I could give the waypoints to avoid instead of waypoints to pass through?
Kurt Acosta
  • 2,407
  • 2
  • 14
  • 29
2
votes
1 answer

Google Maps Directions API returning INVALID_REQUEST when specifying mode as transit

I have tested the API call with my mode set to driving and it works. I have searched around and some say that the call requires departure_time or arrival_time. I have tried that as well, but to no avail. Here is the…
2
votes
1 answer

Is GTFS-realtime data in Google Maps Directions API

I would like to know: Is GTFS-realtime data available from the Google Maps Directions API? If not, are there plans to include GTFS-realtime data in the Google Maps Directions API? I am a member of a team developing a web application that…
mikebrooks
  • 71
  • 1
  • 4
2
votes
1 answer

Draw a path through a list of Latlng in Google Map v2

Sorry about my English grammar ! If u can't understand something, free to ask me again ! I use Volley to draw a path between two point in Google Map private void getPath(LatLng origin, LatLng dest) { // Origin of route String str_origin =…
2
votes
1 answer

Google Direction API Error: "Invalid request. Missing the 'destination' parameter."

I am trying to curl the Google Direction API with JSON output by using instructions provided by https://developers.google.com/maps/documentation/directions/?csw=1#JSON I have tried specifically (this is what is found on the Google Directions API…
beckah
  • 1,543
  • 6
  • 28
  • 61
2
votes
1 answer

Google Directions API in Android

In my Android application I use the Directions API to calculate the traveltime to location A to B by car. Now I am trying to build a new feature using public transportation and with the Directions API you can do this by adding &mode=transit. After I…
mparryy
  • 384
  • 2
  • 18