summaryrefslogtreecommitdiff
path: root/gps
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2016-07-27 12:14:50 -0700
committerGary E. Miller <gem@rellim.com>2016-07-27 12:14:50 -0700
commit5cc13b7c194b6b6dd49925a6eea6a6882feeae9f (patch)
tree86f01c84cb908ca7a7887c040177b80a510bee18 /gps
parenta4dae6f19bd287764d2df1a5ac7510ca5ba67372 (diff)
downloadgpsd-5cc13b7c194b6b6dd49925a6eea6a6882feeae9f.tar.gz
Whoops, MeterOffset() really was used, restore it.
Also, do a sign change by negation, not multiplication! Much better thing to do in double math.
Diffstat (limited to 'gps')
-rw-r--r--gps/misc.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/gps/misc.py b/gps/misc.py
index e329c5a6..f2dd601b 100644
--- a/gps/misc.py
+++ b/gps/misc.py
@@ -218,6 +218,18 @@ def EarthDistanceSmall(c1, c2):
dist = math.sqrt( math.pow(dlat, 2) + math.pow(dlon, 2 ))
return dist;
+def MeterOffset(c1, c2):
+ "Return offset in meters of second arg from first."
+ (lat1, lon1) = c1
+ (lat2, lon2) = c2
+ dx = EarthDistance((lat1, lon1), (lat1, lon2))
+ dy = EarthDistance((lat1, lon1), (lat2, lon1))
+ if lat1 < lat2:
+ dy = -dy
+ if lon1 < lon2:
+ dx = -dx
+ return (dx, dy)
+
def isotime(s):
"Convert timestamps in ISO8661 format to and from Unix time."
if isinstance(s, int):