【问题标题】:How to speed up projection conversion?如何加快投影转换?
【发布时间】:2020-04-26 12:16:58
【问题描述】:

我想投影许多坐标。例如,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))

数据.txt

34.705185 135.498468
...

【问题讨论】:

    标签: python pyproj


    【解决方案1】:

    我建议看这里: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

    【讨论】:

      猜你喜欢
      • 2019-03-05
      • 1970-01-01
      • 2013-01-15
      • 1970-01-01
      • 2014-07-06
      • 2011-02-11
      • 2012-10-30
      • 1970-01-01
      • 2022-08-14
      相关资源
      最近更新 更多