Consulte el artículo de búfer de Zhihu
Y un enlace extranjero https://deparkes.co.uk/2015/03/11/how-to-plot-polygons-in-python/
1. Presentar bien formado
from shapely.geometry import Point, Polygon, LineString
2. Punto, búfer de línea
punto
# 定义点
point_1 = Point(1, 1)
# 两个点以指定的缓冲距离为半径生成圆形区域
a = point_1.buffer(2)
línea
# 定义线段
line = LineString([(0.1, 0.1), (2, 3)])
# 生成缓冲区
buffer = line.buffer(0.5)
3. Entrega y exhibición
Intersección de línea y búfer:
intersect=line.intersection(a)
monitor:
x1,y1=line.xy
x2,y2=buffer.boundary.xy
plt.figure()
plt.plot(x1,y1)
plt.plot(x2,y2)
plt.show()
Mostrar resultado: