[QGIS-trac] [Quantum GIS] #1657: Vector Layer Translate Feature

Quantum GIS qgis at qgis.org
Mon Apr 27 08:16:38 EDT 2009


#1657: Vector Layer Translate Feature
------------------------------------------------+---------------------------
   Reporter:  jopan                             |              Owner:  mhugent
       Type:  bug                               |             Status:  new    
   Priority:  major: does not work as expected  |          Milestone:         
  Component:  Python                            |            Version:  1.0.0  
   Keywords:                                    |   Platform_version:         
   Platform:  Debian                            |           Must_fix:  No     
Status_info:  0                                 |  
------------------------------------------------+---------------------------
 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.

 I use the following code:

 vlayer = iface.activeLayer()

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

 f = QgsFeature()

 while provider.nextFeature(f):
         error_code = vlayer.translateFeature(f.id(), delta_x, delta_y)


 If the feature to translate is not one of the visualized features, the
 error_code is 1 and the feature is not translated.

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/1657>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list