Lately I have been dealing with snappings in QGIS. I have been able, with help of people from this site, and also, having a look at other peoples plugins, to ensemble a small plugin with forms.

My question is regarding the units of snapping, my layers are spatialite layers in WGS84, the project units is meters, but I could not set snapping to project units, so that left me degrees or pixels, for the time being I set the tolerance to 10 pixels, but what I really wanted is to set the snapping tolerance to length units.

If I use decimals degrees, the number is very small and I could not entered it in the box of tolerance, the minimal tolerance in degrees would be equivalent to a big tolerance in meters.

So now I have to ask, how do I calculate the equivalence between pixels and meters? Are pixels fixed or zooming affects the size of the pixels?

  • You may find iface.mapCanvas().mapUnitsPerPixel() useful, though it will still be in degrees if your project is in WGS 84.
    – Matt
    Feb 15 at 21:19
  • Thank you Matt, indeed this answer my question. If I zoom in, the mapsUnitsPerPixel() are smaller.
    – nanunga
    Feb 16 at 8:58


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.

Browse other questions tagged or ask your own question.