문제

I try to merge two Shapely Objects in my Python Project. There is a sort of kind of manual that describes some features of Shapely such as cascaded_union() but I that only works for Polygons. The shapely.ops.unary_union() method should work for other geometries as well but I can't get it to work.

In a nutshell: how do I merge 2 LinearRing Objects?

도움이 되었습니까?

해결책

I actually solved the problem myself.

p1 = Polygon(ring.coords) 
p2 = Polygon(ring2.coords)

to make polygons from my rings. then I create an array with those polygons. merge them with cascaded_union and create a LinearRing from the new polygon.

pols = [p1, p2] 
new_pol = ops.cascaded_union(pols) 
new_ring = LinearRing(new_pol.exterior.coords)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top