2017-06-16 168 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宽或点彼此远离。当点靠近投影中心点时,投影效果很好。
相关问题