0

I am trying to find a means of using JavaScript to calculate the distance between two co-ordinates in kilometers to the first decimal place, specifically using the standard Google Maps co-ordinate format: [-33.959771, 18.484708] rather than this formula which uses the UTM format.

Thanks for the help!

VisioN
  • 143,310
  • 32
  • 282
  • 281
user1434739
  • 235
  • 4
  • 13
  • Well I know how to solve this using the above mentioned Haversine formula and doing the DD to UTM conversion, but that seems a bit square peg round hole. If I have the co-ordinates in DD, surely there is an appropriate formula for calculating in the same unit of measurement? – user1434739 Feb 21 '13 at 08:43
  • as @Richard pointed out, http://stackoverflow.com/questions/1502590/calculate-distance-between-two-points-in-google-maps-v3 gives you at least 2 ways to get this, either by calculating it yourself, or using google's api. – Pascal Belloncle Feb 21 '13 at 09:10
  • yups.. http://stackoverflow.com/questions/1502590/calculate-distance-between-two-points-in-google-maps-v3 should do the job for you. p1 and p2 there are the co-ordinates – Manish Kumar Feb 21 '13 at 09:11
  • Thanks, the google implementation is perfect as I am already using their API on this page. – user1434739 Feb 21 '13 at 09:21

0 Answers0