[Qgis-developer] set snap option from python

Martin Dobias wonder.sk at gmail.com
Fri Jun 11 06:55:21 EDT 2010


On Wed, Jun 9, 2010 at 4:36 PM, Simon Keller <simonkeller at gmx.ch> wrote:
> Hi,
>
> can someone tell me, how I can set the snapping option from python.
> Which are shown in the menu "Settings", "Project Properties" -> "Snapping
> options..."

Hi Simon,

you could get these settings from QgsProject instance by querying the
list of layers, list of snapping tolerances etc. You can find out more
in QgsMapCanvasSnapper class:
http://trac.osgeo.org/qgis/browser/trunk/qgis/src/gui/qgsmapcanvassnapper.cpp
(look into snapToBackgroundLayers function, starting at line 128)

A word of caution: the entries related to snapping in QgsProject are
not a part of public API, so their semantics may change without a
prior notice (though I don't expect this to happen anytime soon).

Regards
Martin


More information about the Qgis-developer mailing list