Bug report #3987

QgsVectorLayer.Select() works only on Postgis layers, not on shapefiles

Added by luca76 - over 9 years ago. Updated about 9 years ago.

Status:Closed
Priority:High
Assignee:Jürgen Fischer
Category:Python plugins
Affected QGIS version: Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed
Crashes QGIS or corrupts data: Copied to github as #:13979

Description

I wrote a PYTHON plugin that does a simple feature select on a QgsVectorLayer:

pnt = <coordinates of mouse click on map >
myLayer= <QgsVectorLayer Object>
tolerance = 1
rectangle = QgsRectangle()
rectangle.setXMinimum (pnt.x() - tolerance)
rectangle.setXMaximum (pnt.x() + tolerance)
rectangle.setYMinimum (pnt.y() - tolerance)
rectangle.setYMaximum (pnt.y() + tolerance)
myLayer.select(rectangle , True)
  • in QGIS 1.6 this code works with both shapefiles and postgis layers,
  • in QGIS 1.7 it works ONLY in postgis layers, on shapefile layers it always returns 0 features.

testSelection.zip - test plugin (14.9 KB) luca76 -, 2011-06-24 05:27 AM

History

#1 Updated by luca76 - about 9 years ago

I am attaching a ZIP of a test plugin with select() function.

On 1.7 it works ONLY on PostGIS layers, NOT on SHP/spatialite layers.

#3 Updated by luca76 - about 9 years ago

  • % Done changed from 0 to 100
  • Target version changed from Version 1.7.0 to Version 1.7.1
  • Pull Request or Patch supplied set to No
  • Status changed from Open to Closed
  • Due date set to 2011-07-15
  • Assignee set to Jürgen Fischer
  • Resolution set to fixed

Also available in: Atom PDF