[Qgis-developer] Python: How to allow for more results using QgsSnapper.snapMapPoint(...)

Casper Børgesen (CABO) CABO at NIRAS.DK
Wed Aug 17 23:22:10 PDT 2016


Hi Martin

I guess what you are writing is exactly what should be written in the cookbook. If you want to handle stuff and updates yourself use the provider. If you want QGIS to sense and react to your updates, use the layer.

Regards, Casper


-----Original Message-----
From: Martin Dobias [mailto:wonder.sk at gmail.com] 
Sent: 18. august 2016 07:32
To: Casper Børgesen (CABO)
Cc: qgis-developer at lists.osgeo.org
Subject: Re: [Qgis-developer] Python: How to allow for more results using QgsSnapper.snapMapPoint(...)

On Fri, Aug 12, 2016 at 2:26 PM, Casper Børgesen (CABO) <CABO at niras.dk> wrote:
>
> Since I cannot remember all the syntaxes and ways to do stuff I found this page, which I have found so many times now:
>
> http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/vector.
> html
>
> The page suggest that you go through the data provider. Perhaps that is not the best way to go anymore, or does it depend on what you want to do?

The page is somehow outdated... You can go directly through data provider, it is the most efficient way, but probably most often you want to do the updates to vector layers through QgsVectorLayer methods because these will notify other parts of the code about the changes, and they are integrated with undo/redo functionality, so you as a developer (or user in GUI) can roll back any pending changes until they are committed (that's the point when data provider's method are called internally).

Cheers
Martin


More information about the Qgis-developer mailing list