java - I want to calculate distance in a gps -
i working on gps project. have read xml file, can print out longitude , latitude bounds in form of minlat, maxlat, minlon, maxlon. way,relation , node properties like, id, user, uid, version, visible, changeset , timestamp . can print out tag key , value , reference. problem want calculate distance between 2 points use of latitude , longitude, unclear me on how , of properties printed out console need it. please need help!
you need calculate using haversine formula. here snippet of perl script this, i'd suggest taking @ better explanation: http://jan.ucc.nau.edu/~cvm/latlon_formula.html
and here deeper explanation of problem: http://www.movable-type.co.uk/scripts/latlong.html
haversine formula:
= sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2) c = 2.atan2(√a, √(1−a)) d = r.c
where r earth’s radius (mean radius = 6,371km); note angles need in radians pass trig functions!
(source link above)
Comments
Post a Comment