From dfd439965ab58fb0ecfb6fd882124b7719e36bea Mon Sep 17 00:00:00 2001 From: Di Weng Date: Tue, 2 Jan 2018 19:13:42 +0800 Subject: [PATCH] fix #43: add X_PI constant --- python/eviltransform/__init__.py | 9 +++++---- python/setup.py | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/python/eviltransform/__init__.py b/python/eviltransform/__init__.py index dd65079..4290cfb 100644 --- a/python/eviltransform/__init__.py +++ b/python/eviltransform/__init__.py @@ -8,6 +8,7 @@ 'distance', 'gcj2bd', 'bd2gcj', 'wgs2bd', 'bd2wgs'] earthR = 6378137.0 +X_PI = math.pi * 3000 / 180 def outOfChina(lat, lng): return not (72.004 <= lng <= 137.8347 and 0.8293 <= lat <= 55.8271) @@ -116,8 +117,8 @@ def gcj2bd(gcjLat, gcjLng): x = gcjLng y = gcjLat - z = math.hypot(x, y) + 0.00002 * math.sin(y * math.pi) - theta = math.atan2(y, x) + 0.000003 * math.cos(x * math.pi) + z = math.hypot(x, y) + 0.00002 * math.sin(y * X_PI) + theta = math.atan2(y, x) + 0.000003 * math.cos(x * X_PI) bdLng = z * math.cos(theta) + 0.0065 bdLat = z * math.sin(theta) + 0.006 return bdLat, bdLng @@ -129,8 +130,8 @@ def bd2gcj(bdLat, bdLng): x = bdLng - 0.0065 y = bdLat - 0.006 - z = math.hypot(x, y) - 0.00002 * math.sin(y * math.pi) - theta = math.atan2(y, x) - 0.000003 * math.cos(x * math.pi) + z = math.hypot(x, y) - 0.00002 * math.sin(y * X_PI) + theta = math.atan2(y, x) - 0.000003 * math.cos(x * X_PI) gcjLng = z * math.cos(theta) gcjLat = z * math.sin(theta) return gcjLat, gcjLng diff --git a/python/setup.py b/python/setup.py index c326c12..8e2b5cf 100644 --- a/python/setup.py +++ b/python/setup.py @@ -2,9 +2,9 @@ setup( name = 'eviltransform', packages = [ 'eviltransform' ], - version = '0.1.0', - description = 'Transform coordinates between earth(WGS-84) and mars in china(GCJ-02).', - author = 'googollee, et. al', + version = '0.1.1', + description = 'Transform coordinates among GPS (WGS-84), Baidu (BD-02) and Mars in China (GCJ-02).', + author = 'googollee, et al.', url = 'https://github.com/googollee/eviltransform', keywords = [ 'gis' ] )