how to find the distance from current location to given location?
I am developing an applica开发者_JAVA百科tion related to maps.
By using that I want to develop a code to find the distance from current location to given location, get directions from current location to given location, and get the estimated time to reach from current location to given location.
You get the distance between two locations as follows:
location1.distanceTo(location2);
The result is in meters, as a float. But this is distance as the crow flies.
To get the directions between two locations, including the distance of that route, and the travel time, you need to use Google Directions API
精彩评论