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.
Related
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().
I would like to move between two addresses in Google maps however i do not have the Geo coordinate latlng (latlng range) for this movement. I can select two addresses from a list which i can make the marker move between. Basically i want to show movement between two locations.
Is it possible that i can ask Google maps for a list of all location names on its map?
Like in this example but i would like to provide a drop down list of all existing addresses in that country
The answer to your question as formulated is no. You can't use Google Maps for a list of all location names on its map, that is against the terms of use. You can get lists like that from Open Street Maps and/or geonames.org (an in the US from the census tiger data), it just might not be consistent with the map displayed by Google.
I am using the google geocodeing and for a lot of the rural addresses the marker gets placed in the middle of the lot. What I need to have is the marker placed on the street in front of the address that was geocoded.
Here is a link to what I currently have for testing.
http://www.commsoft.net/maps/index.html
Any suggestions would be greatly appreciated.
You could possibly use the Google Maps API StreetViewService to get the street location you need.
Google Maps API - Directly Accessing Street View Data
Get the latLng location using the Geocoder
Send that location, a search radius, and a callback function to the streetview service:
var streetViewService = new google.maps.StreetViewService();
streetViewService.getPanoramaByLocation(location, searchRadius, callbackFunction);
The streetViewService will respond with the closest streetView photo it has to your location. In your callback function, callbackFunction(data, status), data.location.latLng will contain the location on the street where that streetview photo was taken.
Use that location for your marker.
It isn't a perfect solution, but it might be the best you can do, short of storing your own street locations in a database. The main drawback is that, in order for it to work, the address must have a streetview image. So if you are mostly concerned with rural addresses, it might not work for you.
The best way to display multiple addresses on a Google Maps API map is to geocode them off-line and store the coordinates in your database (or where ever you are getting the addresses from). If you are going to display more than 10-15 markers using the geocoder or the directions service, you will run into the quota/rate limits.
If you geocode the addresses off line, if you don't like the values that are returned by the geocoder, you can fix them.
An option for programmatically getting coordinates on the street nearest an address is to use the directions service (get directions from the address of interest to itself, should result in a zero length route with the same start and end point on the road at the point closest to the address).
example using your addresses
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
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