I have 2 types of Polygons. one big Polygon (P1) and multiple smaller polygons (P2) all located inside P1.

Is there a way to get the line segments that intersect/touch?.

Running "Geoprocessing Intersect" gives me the polygons. I only need the actual lines segments that touch not the whole polygons.

I'm attaching an example image, I need to get the red line. Is it possible to do this automatically? Get Intersecting line from polygons

1 Answer 1


In the GRASS toolbox, you can use :

grass.run_command('v.overlay', ainput=yourlines, atype='line',
                           binput=polygon2, output=result,
                           operator='and', snap='2')

You can adjust snap value if your lines not exactly overlap the polygon limits.

Your Answer

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

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