あなたが言うことをする必要があります。そのためには、投影を扱うライブラリを使用する必要があります(ここではpyproj
が選択です)。機能point_buff_on_globe
はあなたにその点を中心に正距方位図法で与えられた点をバッファリングした結果である緯度経度でのポリゴン(あなたができる最善を与える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
で同様の質問があります要件2つの観測:。。
- 私は
radius
引数の単位を覚えていない私は、メートルであるので、あなたは10キロのバッファが必要な場合、あなたはそれが10E3渡す必要になると思う。しかし下さい。それを確認してください!
- または離れて離れている点を含むことができる。プロジェクションは、プロジェクションを中心にしているポイントにポイントが近くなるとうまく動作します。