diff options
author | Gary E. Miller <gem@rellim.com> | 2016-07-25 20:34:35 -0700 |
---|---|---|
committer | Gary E. Miller <gem@rellim.com> | 2016-07-25 20:34:35 -0700 |
commit | a99af857eba37a1d678ac7fbe3067043e2c0e04b (patch) | |
tree | 7df015cada5454e5666b1e3852a38525a07dcdeb /gpsprof | |
parent | 6dd99c2d630b72062a44d99d4f992e2403eca491 (diff) | |
download | gpsd-a99af857eba37a1d678ac7fbe3067043e2c0e04b.tar.gz |
Move EarthDistanceSmall() into gps/misc.py
Other programs can use it. The accuracy looks good, not great, but
WAY better than EarthDistance() and small angles.
Diffstat (limited to 'gpsprof')
-rwxr-xr-x | gpsprof | 16 |
1 files changed, 0 insertions, 16 deletions
@@ -20,22 +20,6 @@ import socket import sys import time -def EarthDistanceSmall(c1, c2): - "Distance in meters between two close points specified in degrees." - # This calculation is known as an Equirectangular Projection - # fewer numeric issues for small angles that other methods - (lat1, lon1) = c1 - (lat2, lon2) = c2 - dlat = lat1 - lat2 - avglat = (lat1 + lat2 ) /2 - dlon = (lon1 - lon2) * math.cos( math.radians( avglat ) ) - # Earth Mean Radius 6371000 meters. - # one degree lat, average 111.133000 - # at equator 110.567 km - # at poll 111.699 km - dist = math.sqrt( dlat * dlat + dlon * dlon) * 111133 - return dist; - class Baton(object): "Ship progress indication to stderr." |