[Qgis-user] Vector Layer Translate Feature

Carson Farmer carson.farmer at gmail.com
Mon Mar 30 05:43:49 PDT 2009


Pietro,
> I'm writing a Python plugin to allow the user to translate a whole vector 
> layer by a given shift.
>
> I use the translateFeature() of the QgsVectorLayer class but if the layer is 
> zoomed the function translates only the visualized features.
>
> Can someone point me a way to act on the whole layer regardless of the current 
> zoom?
>   
In your provider.select() call, what do you use for the spatial filter? 
If you want to run through all features in the layer, make sure you 
don't specify any bounds in the rect variable:

attrs = provider.attributeIndexes()
provider.select(attrs)

or if that doesn't work, specify the extent of the layer as the rect 
using layer.extent(), which is inherited from QgsMapLayer...

Cheers,

Carson

-- 
Carson J. Q. Farmer
ISSP Doctoral Fellow
National Centre for Geocomputation (NCG),
Email: Carson.Farmer at gmail.com
Web:   http://www.carsonfarmer.com/
       http://www.ftools.ca/





More information about the Qgis-user mailing list