1

I want to snap the line (completely present inside the polygon) to polygon boundary. I tried create 10 m buffer on line start and end point to get polygon and check intersection between line and polygon it returns all the line vertices as intersected. I want only intersection of line to polygon boundary. I use the following code to get an intersection. My aim is if line is 10 m distance to border snap to line border.

 intersection = line.geometry().intersection(polygon.geometry())
 intersectstr= intersection.exportToWkt()
 gem=QgsGeometry.fromWkt(intersectstr)
 intersetpnt=gem.asPoint()

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.