2017-06-16 303 views
-1

據我所知,很適合只使用笛卡爾座標系。我在地球上有兩個經緯度和緯度座標。我需要在這兩個點周圍創建1km半徑的緩衝區,並找到這個緩衝區相交處的多邊形。在地球上投影相交兩個勻稱的多邊形

但是construstion

緩衝液=點(54.4353,65.87343).buffer(0.001)創建簡單的圓形,但是在地球上投射變得橢圓形,但我需要用1公里半徑內兩個真實圓。

我認爲,我需要將我的緩衝區轉換爲新的投影,然後相交,但現在不知道它有多正確。

回答

0

你需要做你所說的。爲此,您需要使用處理投影的庫(此處爲pyproj)。有一個在Geodesic buffering in python

import pyproj 
from shapely.geometry import MultiPolygon, Polygon, Point 
from shapely.ops import transform as sh_transform 
from functools import partial 

wgs84_globe = pyproj.Proj(proj='latlong', ellps='WGS84') 

def point_buff_on_globe(lat, lon, radius): 
    #First, you build the Azimuthal Equidistant Projection centered in the 
    # point given by WGS84 lat, lon coordinates 
    aeqd = pyproj.Proj(proj='aeqd', ellps='WGS84', datum='WGS84', 
         lat_0=lat, lon_0=lon) 
    #You then transform the coordinates of that point in that projection 
    project_coords = pyproj.transform(wgs84_globe, aeqd, lon, lat) 
    # Build a shapely point with that coordinates and buffer it in the aeqd projection 
    aeqd_buffer = Point(project_coords).buffer(radius) 
    # Transform back to WGS84 each coordinate of the aeqd buffer. 
    # Notice the clever use of sh_transform with partial functor, this is 
    # something that I learned here in SO. A plain iteration in the coordinates 
    # will do the job too. 
    projected_pol = sh_transform(partial(pyproj.transform, aeqd, wgs84_globe), 
          aeqd_buffer) 
    return projected_pol 

功能類似的問題point_buff_on_globe會給你緯度經度多角形的緩衝,在這一點上(你可以做的最好的爲中心的等距方位投影給定點的結果您的需求兩個意見:。

  1. 我不記得radius參數的單位,我認爲是米,所以如果你需要有10公里的緩衝區,你就需要通過它10E3但是,請檢查它!
  2. 小心使用此與半徑to寬或點彼此遠離。當點靠近投影中心點時,投影效果很好。
相關問題