import pandas as pd
import numpy as np
import math
class CoordinateConversion():
def __init__(self):
self.x_pi = 3.14159265358979324 * 3000.0 / 180.0
self.pi = 3.14159265358979324
def bd_google_encrypt(self,bd_lat,bd_lon):
lon=[]
lat=[]
for i in range(len(bd_lat)):
x = bd_lon[i] - 0.0065
y = bd_lat[i] - 0.006
z = math.sqrt(x * x + y * y) - 0.00002 * math.sin(y * self.x_pi)
theta = math.atan2(y, x) - 0.000003 * math.cos(x * self.x_pi)
gg_lon = z * math.cos(theta)
gg_lat = z * math.sin(theta)
lon.append(gg_lon)
lat.append(gg_lat)
df=pd.DataFrame()
df['lat']=lat
df['lon']=lon
print(df)
df.to_csv('goole_lat_lon.csv',index=False)
CoordinateConversion().bd_google_encrypt(lat,lon)