假设我有几个python.shapely.LineString对象。我在所有这些周围构建了缓冲区,获得了几条缓冲线。现在我想将所有这些缓冲区形状合并为一个(所有这些形状的逻辑和),但我不能将它们视为Polygon对象,因为它们只是缓冲线。有什么建议怎么做?
答案 0 :(得分:1)
cascaded_union可用于“合并”几何列表。 E.g。
from shapely.geometry import LineString
from shapely.ops import cascaded_union
lines = [
LineString([(845, 555), (365, -5), (130, -650)]),
LineString([(740, 605), (640, 60), (315, -375)]),
LineString([(0, -500), (655, -150), (900, 300)]),
]
# Two example unions
unioned_lines = cascaded_union(lines)
unioned_buffered_poly = cascaded_union([l.buffer(50) for l in lines])