Google Maps, how to show distance and travel time in the map - javascript

I have used the directions service to render a route on Google Maps. I managed to show the distance and travel time on a marker via the response object which contains the data. But how do I show the information on hover on the blue polylines?
For example:
I have been unable to find this feature in the documentation, but my customer is saying he had this feature in his old website (which is offline, not available anymore).
Is this feature still available in Google Maps? And if so, where are the docs located for this particular feature? Is there another another solution?

Related

Showing stops on bus route using google map on wen application

I have developed a web application for showing bus route between two different stations. I want to show all the stops on the bus route. I have checked this forum and could not find exactly what I am looking for. I am using Google transit API to show the route between two stations. I have more than 30 stops on the route and I want to show them like the Google direction shows when you search the direction between two places on Google maps.
My Second question is can I draw a bus route with out using Google transit API. Any help will be highly appreciated.
Thanks
Pramod
In order to avoid using the API, you can construct a transit route URL something like this: https://www.google.com/maps/dir/Boston,MA/Bufalo,+NY/data=!4m2!4m1!3e3
This is the simplest URL that will give you a map with the Transit mode between Boston and Buffalo. This URL can be used inside an iframe.
Whether you see the bus stops or not depends on the zoom level.
You can explore the nuances of Google Maps URLs in various posts on the web, or by experimenting with a map. The embed codes that Google uses can be found in the address bar, or by using the embed map selection from the Google Maps menu.

Open a Google Maps link with multiple markers

We'd like to open a list of locations in a Google Map link. I've explored many possibilities, but I can't find how to do this.
The map I built using the JavaScript API doesn't show a link to Google Maps with markers on it. I hoped for a "View Larger Map" link like in the Embed API, but none of the variables seemed to add that. I tried the Embed API, but it doesn't take multiple markers.
We need to generate the list dynamically, so MyMaps doesn't work.
The Static Maps API isn't really a Google Map, in that you can't do anything with it.
I tried sending a KML file like this:
http://maps.google.com/maps?q=http://example.com/j.kml
but it looks like Google has discontinued that.
The most promising thing has been the Directions API, but we don't want directions, just a bunch of markers. The URL structure that is showing multiple points is:
https://www.google.com/maps/dir/Mi+Mero+Mole,+5026+Southeast+Division+Street,+Portland,+OR+97206/3+Doors+Down+Cafe,+Southeast+37th+Avenue,+Portland,+OR/Bunk+Downtown,+211+Southwest+6th+Avenue,+Portland,+OR+97204/#45.5135928,-122.661738,14z/
But I tried removing /dir/ to get rid of the directions and Google didn't like that. Has anyone had any luck with this?
My research on the same issue, shows that the directions URL -you have posted- is the most relevant solution at this point.
The only think I could possibly propose as an enhancement, is to leave the starting point blank so the user will be prompted to enter an address as a starting point or automatically enable geolocation by appending the Current+Location wording to the url next to /dir/:
Enable Geolocation
https://www.google.com/maps/dir/Current+Location/Mi+Mero+Mole,+5026+Southeast+Division+Street,+Portland,+OR+97206/3+Doors+Down+Cafe,+Southeast+37th+Avenue,+Portland,+OR/Bunk+Downtown,+211+Southwest+6th+Avenue,+Portland,+OR+97204/#45.5135928,-122.661738,14z/
Leave Starting Point Empty
https://www.google.com/maps/dir//Mi+Mero+Mole,+5026+Southeast+Division+Street,+Portland,+OR+97206/3+Doors+Down+Cafe,+Southeast+37th+Avenue,+Portland,+OR/Bunk+Downtown,+211+Southwest+6th+Avenue,+Portland,+OR+97204/#45.5135928,-122.661738,14z/

embedded google map change center or zoom

I have an embedded Google map (the kind you get an embedded iframe for using the Google maps site) with multiple markers on it. This is good so far as it goes but I need another function.
What I want to do is allow a person visiting the page to change to centre point by entering their postal code. I'd like them to also be able to change the zoom factor.
While there is massive amounts of documentation on using Google maps and on using the Google maps API, what I'm missing is a way to use the existing embedded Google map rather than creating a new blank map and populating it with markers.
The difference is important because it's quite easy to use the Google maps site to upload a .csv file with names and addresses that the Google map sorts out and displays. Doing the same thing with a blank map and javascript each time the page is loaded runs you up against the API transaction limits.
How can I tell the Google map API to connect to an embedded map instead of creating an empty one?

map data to make a Web application for displaying location of my customers

I want to create a Web application in which I need a map data of certain area and would like to show the details or location of my customers.
I have seen the Google maps api, but I was searching if I could get something privately for my web application.
Please reply. Thanks.in advance
You can add marker to your map. Markers are designed to be interactive with 'click' events. You can add an event listener to bring up an info window displaying custom information. These marker will only show what you specify. They will not show other marker ( shops,petrol bunks,aims etc)
You can always use the Places API from Google in order to show various places on the Google Maps and also the detailed description about that Places.
Here is the detailed description for the Places API.
Here is a tutorial that may help you in your implementation.

Which one to use - Kml or Google Map Api

I want to show locations on google map based on the user search criteria i.e; if a user selects London, then all records from London should be displayed and if user enters his postcode then it should show the result within 25 miles of his postcode on the google map(All data will be coming from database php/mysql).
Now the question is What should I use? KML or google map api V3, As i want to give option to user to see brief info about the location, when he will mousehover that marker, and onClick of that marker I want to show the image of location and review count, and distance(calculated dynamically based on his postcode.), I also want to ceate custom markers. I have done some work on api V3 previously but wanted to know about KML. Does it supports my need? As according to my understanding KML is just a static file and can't give such dynamics.If so, can you please provide any sample and how to do that.
Thanks
Your understanding is correct, KML are just static files. You should be able to complete your requirements using combination of google maps api v3 methods like geocode, computeDistance etc.

Categories