Calculating distance between two points accurately
i want calculate distance between 2 points. have latitude , longitude of each of points string formatted dddmmmmm (i.e. degrees, minutes , decimal fractions of minutes).
step 1 convert latitude , longitude string decimal number of degrees.
step 2 calculate distance between 2 points using 1 of various mathematical formula available on net. (this 1 cribbed http://williams.best.vwh.net/avform.htm#dist)
before start on i'm not sure if it's going possible reasonable degree of accuracy. need able convert string latitude , longitude number. best data type seems float, on arduino reference pages i've found following....
i need have lat , long degrees @ least 6 decimal places. seems float isn't going manage this, correct?
if can't lat , long accurately converted decimal, formula quoted above isn't give me accurate distance. there's few functions calculating distance between 2 points on forum, use floats, guess none of these can accurate? i'd able distance correct within few 10s of meters.
any suggestions? had wondered splitting lat , long degrees (as integer) , minutes (as float),this should give me required accuracy, i've got somehow work out distance 2 points using lot more variables
step 1 convert latitude , longitude string decimal number of degrees.
step 2 calculate distance between 2 points using 1 of various mathematical formula available on net. (this 1 cribbed http://williams.best.vwh.net/avform.htm#dist)
quote
the great circle distance d between 2 points coordinates {lat1,lon1} , {lat2,lon2} given by:
d=acos(sin(lat1)*sin(lat2)+cos(lat1)*cos(lat2)*cos(lon1-lon2))
before start on i'm not sure if it's going possible reasonable degree of accuracy. need able convert string latitude , longitude number. best data type seems float, on arduino reference pages i've found following....
quote
floats have 6-7 decimal digits of precision. means total number of digits, not number right of decimal point.
i need have lat , long degrees @ least 6 decimal places. seems float isn't going manage this, correct?
if can't lat , long accurately converted decimal, formula quoted above isn't give me accurate distance. there's few functions calculating distance between 2 points on forum, use floats, guess none of these can accurate? i'd able distance correct within few 10s of meters.
any suggestions? had wondered splitting lat , long degrees (as integer) , minutes (as float),this should give me required accuracy, i've got somehow work out distance 2 points using lot more variables
how far apart points in question? if 1 point in america , other point in europe, why need distance accurate?
if points not far apart, perhaps great circle distance isn't required, , simple(r) point-to-point distance calculation work.
if points not far apart, perhaps great circle distance isn't required, , simple(r) point-to-point distance calculation work.
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Calculating distance between two points accurately
arduino
Comments
Post a Comment