[Qgis-developer] Setting snapping settings via Python

John Stevenson john.stevenson at thinkwhere.com
Wed Jan 20 09:20:26 PST 2016


Hi,

Is there a way to set the snapping settings for a layer via Python?  I would like to turn on snapping with a specified tolerance automatically when a user begins editing within a plugin.

There is a question on gis.stackexchange, but it hasn't been answered.

http://gis.stackexchange.com/questions/133816/how-to-enable-the-snapping-options-for-vector-layer-using-the-python-programming

QSettings stores some values, but these are the defaults:

    qs = QSettings()
    qs.value('Qgis/digitizing/default_snap_mode')
    qs.value('Qgis/digitizing/default_snapping_tolerance')
    qs.value('Qgis/digitizing/default_snapping_tolerance_units')

I have also found the canvas.snappingUtils(), but cannot find functions there to enable snapping modes or set tolerances.

Thanks,
John


John Stevenson
Senior Developer


[cid:image985e2b.PNG at 7eaab0b3.4abdcafe]<http://www.thinkwhere.com>


t: 01786 476060 (Office)
t: 01786 476093 (Direct Dial)
w:www.thinkwhere.com<http://www.thinkwhere.com>


Glendevon House
Castle Business Park
Stirling FK9 4TZ


[cid:imageb46136.PNG at a13dc9e0.43bf4b39]<https://twitter.com/thinkWhere1> [cid:image064812.PNG at 9af40f23.4298b90c] <http://www.linkedin.com/company/1509510?trk=companies_home_ycp_logo_forth-valley-gis>


This email and its attachments are private and confidential. If you believe you have received this email in error, please contact the sender immediately on 01786 476060. If you are not the intended recipient, you may not rely on, use or disclose this email or any attachments in any way.

thinkWhere Limited does not accept any liability for any damage that may be caused to the recipient's system or data by this email or any attachments. Please note that our email system may be subject to random monitoring by us. This Company accepts no liability for personal emails.

thinkWhere is a limited company registered in Scotland with Registered Number SC315349 and having its Registered Office at Glendevon House, Castle Business Park, Stirling, FK9 4TZ.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160120/0c32e3dc/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image985e2b.PNG
Type: image/png
Size: 7004 bytes
Desc: image985e2b.PNG
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160120/0c32e3dc/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imageb46136.PNG
Type: image/png
Size: 3618 bytes
Desc: imageb46136.PNG
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160120/0c32e3dc/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image064812.PNG
Type: image/png
Size: 3751 bytes
Desc: image064812.PNG
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160120/0c32e3dc/attachment-0005.png>


More information about the Qgis-developer mailing list