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
9
votes
3 answers

How do we get the shortest distance route from point A to B by default from Google Direction API

How do we get the shortest distance route from point A to B by default from Google Direction API suggested alternative routes? By default it gives us shortest duration routes depending upon the current traffic conditions. I have noticed that google…
Rameshwor Maharjan
  • 242
  • 2
  • 3
  • 10
8
votes
1 answer

Android Draw polylines with arrow on google map with direction path

I have added polylines but not able to add arrow with direction on google map should be display as below And when it zoom up, more arrow should be display like below I have tried reading various blogs and codes but not able to get the goal I have…
8
votes
3 answers

Travel Distance between two Lat and Long

I am looking to calculate and give the distance between two sets of Lat and Long for travel on Road. I have had a look at the Google's Directions and Distance Matrix API. And also done a lot of other questions on SO. But i am not able to figure out…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
7
votes
2 answers

Android, draw route on google map

In my android project I want to draw route on Google maps. I have coordinates of start and end points. On this points I get km-file from Google web service with points witch across route. For drawing parts of route I use instances of Overlay class.…
Dmitriy
  • 93
  • 1
  • 2
  • 6
7
votes
4 answers

Getting distance from Google Direction API in Android

http://maps.googleapis.com/maps/api/directions/json?origin=-20.291825,57.448668&destination=-20.179724,57.613463&sensor=false&mode=%22DRIVING%22 For example this link generate the following: "routes" : [ { "bounds" : { …
Breaking code
  • 75
  • 2
  • 2
  • 5
6
votes
1 answer

Google Directions Api returning 0 routes

We are calling the google directions api to calculate round trip values. In general it works perfectly. I have however come across a use case where it fails to come up with any route. However when we use the js google.maps.DirectionsService version…
Murdock
  • 4,352
  • 3
  • 34
  • 63
6
votes
2 answers

Adding InfoWindow on Google directions route

I am trying to add an InfoWindow to directions route. there are lots of examples out there for adding InfoWindow on an event listener on a marker. But how can I move the InfoWindow to show on the actual planned route from one marker to another.…
5
votes
2 answers

{ "error_message": "You must enable Billing on the Google Cloud Project }

Trying to get Direction route between two points in map This is the url i am using to get directions (https://maps.googleapis.com/maps/api/directions/json?origin=16.3064857,80.4418659&destination=27.2038,77.5011&mode=driving&key=MyApiKey) Also I…
5
votes
1 answer

How to plot current traffic data to google map on specific poly line that have been drawn by Google Direction API

I am making an app in Android with some function same to Google Map find direction to specific location. I had draw route(polyline) from one place to another place received by google direction API. Here my question is that I want to put current…
5
votes
2 answers

Google Directions API transit returns always "ZERO_RESULTS"

i'm developing an app that use google API to obtain a transport solution to reach a location at a desired time. My code that call google API work perfectly with "driving" and "walking" travel mode, but with "transit" and "bicycling" the response is…
5
votes
0 answers

delete Polyline rendered with react-native(0.45.1), react-native-maps(0.15.3) and mapbox

I need to delete the polyline I've drawn on the component when a user performs a new search. Right now I end up with 2+ routes all drawn on the same map instead of the new search displaying only the new route. I followed this tutorial to render the…
5
votes
1 answer

Get way Points between two locations

I was trying to develope an iOS app similar to this app. I need to calculate the intermediate locations between two cities or two locations. I couldn't figure out which API was the best. I tried google directions API. But that donot provide…
Amrit Sidhu
  • 1,870
  • 1
  • 18
  • 32
5
votes
1 answer

How to get all cities info over a route between two geo points

I have an question that while using Google Direction Api we can get the list of data like city's name, its Lat & Lng etc but the data provided by Api is limited to some extend. It's not able to provide all cities coming with-in that particular…
Karan
  • 73
  • 1
  • 8
5
votes
1 answer

MKMapView overlay Polyline is drawn on top of road label

I am making the navigation application by drawing a direction between 2 points. I successfully archive the functionality. But the direction line is drawn on top of the road label and that label cannot be read as show in the picture below. this is…
SaintTail
  • 6,160
  • 4
  • 31
  • 51
5
votes
1 answer

Google Directions API restrictions

I am developing an app that is using google directions api. But the problem I am facing is that google directions api says: The Directions API may only be used in conjunction with displaying results on a Google map; using Directions data without…
Adnan Munir
  • 129
  • 7
1
2
3
34 35