Demo entry 6720772

py

   

Submitted by anonymous on Mar 18, 2018 at 10:14
Language: Python 3. Code size: 391 Bytes.

import os
import pyproj
import pandas as pd

df = pd.read_excel(u"Alldata.xlsx")#这里可以修改成你的数据文件所在路径
lon = df.fCoord_x.values
lat = df.fCoord_y.values
p1 = pyproj.Proj(init="epsg:4326")  # 定义数据地理坐标系
p2 = pyproj.Proj(init="epsg:3857")  # 定义转换投影坐标系
x1, y1 = p1(lon, lat)
x2, y2 = pyproj.transform(p1, p2, x1, y1, radians=True)

df['lon_trans'] = x2
df['lat_trans'] = y2

df.head()

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).