Query on Google Maps API - google-maps

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

Related

Adding multiple directions requests together Google Maps API

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().

How do I name co-ordinates on the new Google Maps?

On the old version of Google Maps I used to be able to add locations such as this into the directions:
Niter Ice Cave#42.53263,-111.72658
This allowed users to give a friendly name to the co-ordinates. Google used the co-ordinates given to place the point on the map and used the name in the directions.
When I try to do this on the new Google Maps it gives me an error message (either "I do not know what that means" or "Couldn't find the exact location so using an approximate location instead" or something along those lines). If I use just the co-ordinates Google (obviously) finds the location fine but I am left with the unfriendly 42.53263,-111.72658 in the directions list.
Is this yet another feature Google has removed or can naming co-ordinates still be done (but by another method)? If the naming of co-ordinates can still be done, how do you do it?

Moving From Point A to B on Map (Google maps or any other map )

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.

Google Maps API v3 pathing with location service

I'm using Google Maps for my campus map and I already have all the overlays for the buildings done along with javascript to open windows when clicked on the overlay, etc. The next problem I'm trying to tackle is how to get directions from point A to point B (using point A as geolocation). On my campus there is about 2.5 miles+ of sidewalks but they aren't defined paths in google maps, so i cannot use the built in directions which Google maps offers.
Is there any way i can make it so it displays directions from point A to point B while making it so it displays a path along a sidewalk?
Thanks in advance.
EDIT: I already have the geolocation working also.
If Google doesn't know about the sidewalks, you will have to do the drawing yourself. You will need to store information about the sidewalks in a database, then come up with a routing algorithm, then draw a line (using the Polyline class).
For routing algorithms, you might be able to get away with using Dijkstra's algorithm
http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
or you could try A*
http://en.wikipedia.org/wiki/A*_search_algorithm
or one of the other algorithms you can find in the Wikipedia sidebar on the Dijkstra and A* pages.
Polyline documentation:
https://developers.google.com/maps/documentation/javascript/overlays#Polylines

Is it possible to change a route given by Google Maps

I'm writing a Google Maps mashup. I ask google the path from one location to another location. Google Maps gives me a Map with the route. I would like to take this route somehow and modify it (adding or removing points) before displaying it in the map. Is it possible? How would you do that?
Many thanks!
According to the Google Maps API Reference, there is a loadFromWaypoints function which will take waypoints in an Array and use them to calculate directions.
Edit: +1 for Cannonade. What he said.