4

I have a geometry question using shapely,Fiona and polygons shapefiles with big data(over 700000 features any polygon shapefile).

polygon1.difference(polygon2)

I want to find the difference between two polygons using shapely (or maybe geopandas?) and I have read this post, I want the difference calculate only in the polygons segments(lines) and not the polygon geometry.

for example if I use code from the post with add more lines the final export difference is a polygon layer,I want the line layer to show me the differences between two polygons.

task

with the light blue line is the difference.

that because I think is more fast the difference calculator to create lines from polygons.

1 Answer 1

5

Once you've calculated the difference between your polygons (let's call this delta), take the difference between the exterior of delta and the exterior of your brown polygon2: result = delta.exterior.difference(polygon2.exterior). Note that the sense of the difference will be significant and it may be tricky to generalize this to all possible polygons. Good luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.