Adding multiple directions requests together Google Maps API - google-maps

I'm trying to get directions for a user provided origin and destination, while showing directions to a middle location for ALL travel modes (driving, walking, bicycling, transit).
I have this coded using waypoints, but I just discovered that the Google Maps API doesn't support waypoints for public transit--as discussed in a previous question here.
I'm having difficulty finding any examples for how to go about piecing together multiple directions requests without using waypoints. Is there a way to add multiple directions to the directionsDisplay variable?
Example: Display directions from A -> B, then add directions from B -> C to the existing display.

Found my answer based on this question: Multiple travel modes to render one map using google maps API
Multiple directionsDisplays are needed, with multiple trip legs (requests) being sent to directionsService.route().

Related

Google Directions API Result is different from Google Maps result

I am developing an app that displays the Distance & path between 2 distances. In this case I have used following addresses:
Source: Major Bhola Ram Enclave
Destination: Ring Road Mall, Sector 3, Rohini, New Delhi, Delhi
When I use Directions API then I get following result, see image below:
But, when I search these addresses in Google Maps then I get different Result.
Click here to see Google Maps result
I searched a lot about this but I couldn't find any reason/solution for this.
Please guid me in right direction.
Thanks.
Those are not addresses, they are places. If you want a similar result to Google Maps, you need to use the placeId or the coordinates returned for that place from the places service in the directions request.
http://www.geocodezip.com/v3_example_geo2.asp?addr1=Major%20Bhola%20Ram%20Enclave&addr2=Ring%20Road%20Mall,%20Sector%203,%20Rohini,%20New%20Delhi,%20Delhi&place=1&place=2
(uses the results from the place service)

Google Maps: navigating between Marker and Indoor Marker

Is it possible to create a route between a Google Maps Marker and a POI of a Indoor Map using the Google Maps API? For "classic" Markers you can use the Directions API, but it seems to be limited to "classic" Markers only.
In the example below I've created a route between an address and a POI inside the Madison Square Garden with Google Maps, but how to realize it through the API?
Screenshot: http://i.imgur.com/aUsxYlh.png?1
Source: https://www.google.com/maps/dir/40.7510242,-73.9931116/40.751578,-73.9939041/#40.7512401,-73.9939461,19.55z/data=!4m2!4m1!3e2
I think you can use the turn-by-turn navigation under Google Maps API. It gives turn-by-turn directions to the address or coordinate specified. Directions are always given from the users current location.
google.navigation:q=a+street+address
google.navigation:q=latitude,longitude
This is the parameters that you can use.
q: Sets the end point for navigation searches. This can be a latitude,longitude or a query formatted address. If it is a query string that returns more than one result, the first result will be selected.
mode sets the method of transportation. Mode is optional, defaults to driving, and can be set to one of:
d for driving
w for walking
b for bicycling
avoid sets features the route should try to avoid. Avoid is optional and can be set to one or more of:
t for tolls
h for highways
f for ferries
The below intent will give you an example of turn-by-turn navigation.
Uri gmmIntentUri = Uri.parse("google.navigation:q=Taronga+Zoo,+Sydney+Australia");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, gmmIntentUri);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
I hope it can help you in your problem.

show directions on google maps website

So I have successfully found directions to get some lat/long A to lat/long B using the Google Maps v3 directions api.
I want to be able to take a route from this api and give the user an option to view them on the google maps website.
I dont want to show the route on my website but only show the time it would take to get from A to B.
is this possible?
thanks!
https://developers.google.com/maps/documentation/directions/#Limits
The Directions API may only be used in conjunction with displaying results on a Google map; using Directions data without displaying a map for which directions data was requested is prohibited. Additionally, calculation of directions generates copyrights and warnings which must be displayed to the user in some fashion. For complete details on allowed usage, consult the Maps API Terms of Service License Restrictions.

Query on Google Maps API

I am new to Google maps API. Lets take two locations A and B on the map. I know that maps API would provide me the routes between the two points. (if available). Lets take another location C. I like to know if its possible to find out the nearest location D (to C), which lies in between A and B. With the maps API, would it be possible to find the above information?
It is certainly possible. What you describe is anlogous to the "drag to modify route" functionality of maps.google.com The mouse would be your "C" and the draggable marker that appears on the route would be your "D".
Working demo here:
http://www.marsrutai.info/directions.htm

Google Maps API Driving Directions

I use Google Maps API and I have a map with 20 points on it.
Can I find an API call to give me driving directions and draw lines between them?
Yes, it can be done. The Google Maps API Documentation describes how to this very accurately:
"You can add the ability to calculate directions (using a variety of methods of transportation) by using the GDirections object. The GDirections object requests and receives direction results using either query strings (e.g. "New York, NY to Chicago, IL") or textual lat/lons.
The GDirections object also supports multi-part directions using a series of waypoints. Directions may be displayed as either a polyline drawing the route on a map, as a series of textual description within a <div> element (e.g. "Turn right onto the Williamsburg Bridge ramp") or both."
Unfortunately driving directions are not yet available for all countries. You may want to check the following spreadsheet to see if driving directions are available for a particular location:
Google Code - Map Coverage Filtered