I wa开发者_开发百科nt to use data from Google Maps in my application.
I have two text boxes to add destination A and destination B respectively and I have a panel where I want to show exact mileage or distance of the destination A from destination B using the same data that appears on the Google Maps web GUI, pictured below.
How can I achieve this?
populated on my web-pageIf you're just directing your users to the Google Maps web site, then note that the URL you've linked to already accepts the source and destination addresses as parameters.
For example, to link to the directions between Delhi and Mumbai:
http://maps.google.com/maps?saddr=delhi&daddr=mumbai
EDIT: Now that you've been clearer about what you want to achieve, it's clear that you'll need to use one of the Google Maps API family. Specifically, I suggest that you look at the Distance Matrix in the Web Services API. It sounds like exactly what you're looking for:
The Google Distance Matrix API is a service that provides travel distance and time for a matrix of origins and destinations. The information returned is based on the recommended route between start and end points, as calculated by the Google Maps API, and consists of rows containing duration and distance values for each pair.
精彩评论