3

QGIS 3.14 - plugin. I have a requirement to draw lines which must start and end snapped to point geometries of another layer. I need to be able to detect a vertex snap event while drawing linear geometries so I can know whether the line feature is snapped to a feature from the point layer and if it is then I need to have the id of the snapped feature.

I managed to create my own SnappingMapTool derived from QgsMapToolEmitPoint. My custom tool does exactly the logic I need - it detects a snap event and gives me the snapped layer and feature identifiers.

The problem is QGIS replaces my MapTool with its own whenever I start drawing geometries. How do I somehow access or override the snapping event while drawing geometries? I need to check if the edited/created lines have their ends snapped to a point layer.

How it works at the moment - you can see in the console when the MapTool gets replaced. enter image description here

0

Your Answer

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

Browse other questions tagged or ask your own question.