Python 从左下角坐标创建方形多边形

Python 从左下角坐标创建方形多边形,python,geopandas,shapely,Python,Geopandas,Shapely,我有坐标(纬度,经度),我需要创建100米的多边形。 现在我只能创建一个多边形(正方形),其中点是它的中心,而不是左下角 import geopandas as gpd from shapely.geometry import Point # Generate some sample data p1 = Point((-122.431297, 37.773972)) points = gpd.GeoSeries([p1]) # Buffer the points using a squa

我有坐标(纬度,经度),我需要创建100米的多边形。 现在我只能创建一个多边形(正方形),其中点是它的中心,而不是左下角

import geopandas as gpd
from shapely.geometry import Point


# Generate some sample data 
p1 = Point((-122.431297, 37.773972))
points = gpd.GeoSeries([p1])

# Buffer the points using a square cap style
# Note cap_style: round = 1, flat = 2, square = 3
buffer = points.buffer(1, cap_style = 3)

使用
geopy
生成/构造剩余点

import geopy
import geopy.distance as distance
from shapely.geometry import Polygon

#Assume each site is 100m (question not clear)
d = distance.distance(kilometers=100/1000)

# Going clockwise, from lower-left to upper-left, upper-right...
p1 = geopy.Point(( 37.773972, -122.431297))
p2 = d.destination(point=p1, bearing=0)
p3 = d.destination(point=p2, bearing=90)
p4 = d.destination(point=p3, bearing=180)

points = [(p.latitude, p.longitude) for p in [p1,p2,p3,p4]]
polygon = Polygon(points)

使用
geopy
生成/构造剩余点

import geopy
import geopy.distance as distance
from shapely.geometry import Polygon

#Assume each site is 100m (question not clear)
d = distance.distance(kilometers=100/1000)

# Going clockwise, from lower-left to upper-left, upper-right...
p1 = geopy.Point(( 37.773972, -122.431297))
p2 = d.destination(point=p1, bearing=0)
p3 = d.destination(point=p2, bearing=90)
p4 = d.destination(point=p3, bearing=180)

points = [(p.latitude, p.longitude) for p in [p1,p2,p3,p4]]
polygon = Polygon(points)

一般来说,我建议使用几何坐标(投影),而不是地理坐标。一般来说,我建议使用几何坐标(投影),而不是地理坐标!非常感谢@PeterSmith的快速提问,因此(正方形)每边的距离是100米,这意味着正方形的表面是一公顷?是的,示例代码使用100米作为每边的长度,这使得正方形的面积是1公顷。非常有魅力!非常感谢@PeterSmith的快速提问,因此(正方形)每边的距离是100米,这意味着正方形的表面是一公顷?是的,示例代码使用100米作为每边的长度,这使得正方形的面积是1公顷。