Google, Gaode coordinates -> Baidu coordinates (latitude and longitude)

gcj02tobd09 DEF (lng, LAT): 
Import the Math
#key = 'your Key here Wallpaper' # here to fill your Baidu open platform Key
x_pi 3.14159265358979324 * = 3000.0 / 180.0
PI pi = 3.1415926535897932384626 #
A # = 6378245.0 semi-major axis
ee = 0.00669342162296594323 # Flat rate
"""
Mars coordinate system (GCJ-02) to Baidu coordinate system (BD-09)
Google, Gaode --> Baidu
:param lng:Mars coordinate longitude
:param lat:Mars coordinate latitude
:return:
"" "
z = math.sqrt(lng * lng + lat * lat) + 0.00002 * math.sin(lat * x_pi)
theta = math.atan2(lat, lng) + 0.000003 * math.cos(lng * x_pi)
bd_lng = z * math.cos(theta) + 0.0065
bd_lat = z * math.sin(theta) + 0.006
print (bd_lng)
print (bd_lat)
return [bd_lng, bd_lat]

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324893667&siteId=291194637