-1

I am now using Google mapV2 in my application. i am unable to find distance between 2 locations(Geo-points) and can i calculate the duration to reach from source to destination(by walk or drive)..is there any Google API available?if not so,please guide me to a good tutorial?

progrrammer
  • 4,475
  • 2
  • 30
  • 38
murugan
  • 94
  • 4

1 Answers1

1

It is possible to work out the distance by using Locations and the Distance To methods. E.g

Location locationA = new Location("Point A");  
locationA.setLatitude(POINT A LATITUDE);  
locationA.setLongitude(POINT A LONGITUDE); 

Location locationB = new Location("Point B");
locationB.setLatitude(POINT B LATITUDE);
locationB.setLongitude(POINT B LONGITUDE);

double distance = locationA.distanceTo(locationB); 
SquiresSquire
  • 2,404
  • 4
  • 23
  • 39