Hi I have the same issue using Windows 7.
I've changed the code the intersection with pointBuff instead of pntGeom: if feat.geometry().intersects(pntBuff). It returns a result but the only problem is that it will select every feature within the: pntGeom.buffer( (self.canvas.mapUnitsPerPixel() * 2),0). This can create problems if the user is zoomed out too far. So there must be a better way of solving the Problem. The feat.geometry().intersects(pntGeom) also works for Polygons. So I don't think it's the intersect function that returns no geometry. Kind regards bertGIS wrote > Hello, > I use this code for selecting features, for selecting a feature and get > its parameters in a form. > It works well on Ubuntu, but when moving to Windows 7 with QGIS 1.7.4 or > QGIS 1.8, > the selection does not work, seems to be the intersect function that > returns no geometry. > > Does anybody knows something about that ? > Thanks for your help > > Cheers, > Bert > > def selectFeature(self, point, button): > self.selectList = [] > QMessageBox.information( self.iface.mainWindow(),"Info", "in > selectFeature function" ) > pntGeom = QgsGeometry.fromPoint(point) > pntBuff = pntGeom.buffer( (self.canvas.mapUnitsPerPixel() * 2),0) > rect = pntBuff.boundingBox() > if self.cLayer: > feat = QgsFeature() > self.provider.select([],rect) > while self.provider.nextFeature(feat): > QMessageBox.information( self.iface.mainWindow(),"Info", "loop on > features" ) > if feat.geometry().intersects(pntGeom): > QMessageBox.information( self.iface.mainWindow(),"Info", > "feature" + str(feat.id()) + " inter") > self.selectList.append(feat.id()) > if self.selectList: > self.cLayer.setSelectedFeatures(self.selectList) > self.updateForm() > else: > QMessageBox.information( self.iface.mainWindow(),"Info", "No layer > currently selected in TOC" ) -- View this message in context: http://osgeo-org.1560.n6.nabble.com/Problem-with-intersects-function-on-windows-only-tp4998864p5003200.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. _______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer