python百度坐标系转腾讯坐标系
from math import sin, asin, cos, radians, fabs, sqrt
import math
EARTH_REDIUS = 6378.137
def rad(d):
return d * math.pi / 180.0
def getDistance(row):
lat2 = row['latitude_v2']
lat1 = row['addr_latitude']
lng2 = row['longitude_v2']
lng1 = row['addr_longitude']
radLat1 = rad(lat1)
radLat2 = rad(lat2)
a = radLat1 - radLat2
b = rad(lng1) - rad(lng2)
s = 2 * math.asin(math.sqrt(math.pow(sin(a/2), 2) + cos(radLat1) * cos(radLat2) * math.pow(sin(b/2), 2)))
s = s * EARTH_REDIUS*1000
return s