You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Shapely Polygon缓冲区Y坐标翻倍问题排查求助

问题排查:Shapely固定距离扩展轮廓时Y坐标翻倍问题

我使用Shapely几何图形处理轮廓,需为不同尺寸的场地轮廓按给定值固定距离扩展边界,而非按比例缩放。尝试了两种实现方式:

代码1

from shapely.geometry import Polygon, LinearRing
coords = [(30.3283020760901, 59.929340439331035), (30.32625283518726, 59.929669569762034), (30.326617897500824, 59.93065894162025), (30.328354001537814, 59.93056342794558), (30.329838363175877, 59.93089851628186), (30.330225213253033, 59.929729335995624), (30.3283020760901, 59.929340439331035)]
poly_B = Polygon(coords)
poly_A = s.buffer(0.005, quad_segs=10.0, cap_style=1, join_style=2, mitre_limit=10.0)

代码2

r = LinearRing(coords)
poly_B = Polygon(r)
poly_A = Polygon(s.buffer(0.005).exterior, [r])

但每次生成的轮廓均出现Y坐标翻倍问题(见附图),需大轮廓相对小轮廓保持均匀扩展距离,恳请排查问题原因。


内容的提问来源于stack exchange,提问作者Denis

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.03 21:35:18