[Qgis-developer] delete feature
Martin Dobias
wonder.sk at gmail.com
Thu Dec 18 11:32:41 EST 2008
On Fri, Dec 12, 2008 at 1:02 PM, piko <piklas at gmail.com> wrote:
>
> sprayerProvider = self.sprayerLayer.dataProvider()
> sprayerProvider.addAttributes( { "name" : "string" } )
>
> if self.sprayerLayer.featureCount() ==1:
> sprayerProvider.deleteFeatures([0])
> self.canvas.refresh()
>
> [...]
>
> So the feature is created and the layer added,
> but i want to delete and replace the feature each time the user click
> i guess my deleteFeatures doesn't work, because each click creates a new
> feature in the layer
You can't expect that feature id when inserting to an empty layer will
be zero. That's why deleteFeatures() isn't working for you.
Martin
More information about the Qgis-developer
mailing list