我想投影许多坐标。例如,400万个坐标。
首先,我测试了100个坐标。测试结果为13.95秒。
计算得出,要处理400万个坐标需要155个小时。
有没有一种好的方法来尽快获得结果?
import pandas as pd
import pyproj
import time
def projection(points):
from_proj = pyproj.Proj('EPSG:4326')
to_proj = pyproj.Proj('EPSG:2448')
points[0], points[1] = pyproj.transform(from_proj, to_proj, points[1], points[0], always_xy=True)
return points
data = pd.read_csv('data.txt', header=None, delim_whitespace=True)
start = time.perf_counter()
output = data.apply(projection, axis=1)
end = time.perf_counter()
print('{0} sec.'.format(end - start))
data.txt
34.705185 135.498468
...
答案 0 :(得分:0)
我建议在这里查看:https://gis.stackexchange.com/questions/334271/converting-large-data-with-lat-and-long-into-x-and-y
https://pyproj4.github.io/pyproj/stable/advanced_examples.html#advanced-examples
两次加速:
1.使用Transformer进行重复转换
2.直接使用列中的值代替apply