Thanks for help so far.

These suggestions seem to be more complicated than I require.  I do not need to 
use the snapper to modify geometries in a custom tool, just to turn snapping on 
for the current layer when the user begins editing it.  I tried the following, 
based on Etienne's inasafe example, but nothing happens:

layer = canvas.layer(0)
point_locator = QgsPointLocator(layer)
units = QgsTolerance.LayerUnits
layer_config = QgsSnappingUtils.LayerConfig(layer, point_locator.Types(), 50, 
units)
snapper = QgsSnappingUtils()
snapper.setLayers([layer_config])
snapper.setSnapToMapMode(QgsSnappingUtils.SnapAdvanced)

Is there another snapper already created by QGIS when editing begins that I can 
access?

Cheers
John


John Stevenson
Senior Developer


[cid:image8bc20c.PNG@67520999.41b46f51]<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:image295644.PNG@b1051cba.4e97df2b]<https://twitter.com/thinkWhere1> 
[cid:imagea7a708.PNG@070b5c8d.4fa6e904] 
<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.

________________________________
From: Qgis-developer [qgis-developer-boun...@lists.osgeo.org] on behalf of 
Thomas Gratier [osgeo.mailingl...@gmail.com]
Sent: 21 January 2016 11:04
To: Tom Chadwin
Cc: qgis-developer
Subject: Re: [Qgis-developer] Setting snapping settings via Python

Hi,

I'm maybe wrong but you'd better look at QgsSnappingUtils 
http://qgis.org/api/classQgsSnappingUtils.html
It seems more simple and should do the job for you.

Cheers

Thomas Gratier

2016-01-20 20:32 GMT+01:00 Tom Chadwin 
<tom.chad...@nnpa.org.uk<mailto:tom.chad...@nnpa.org.uk>>:
This old thread might also help:

http://osgeo-org.1560.x6.nabble.com/getting-QgsMapCanvasSnapper-to-work-td4147067.html



--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/Setting-snapping-settings-via-Python-tp5246362p5246373.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org<mailto:Qgis-developer@lists.osgeo.org>
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to