[Qgis-user] select features slow down
Hi all, needing to edit/copy/past features from a large vector layer (72,000 features), the select features tool takes ~5sec. each time we want to use it, where it is relatively faster on smalls vector layers (~4,000 features). Is there a flag at the compilation time to improve the speed, or something else to do? In the same time, how can we deselect a previously selected feature without deselecting all the others features? Thanks PS : We use QGIS1.0.0 preview2 from the ubuntu launchpad repository, on a Intel Core2 6400 CPU (2.1GHz). -- Lionel Roubeyrie chargé d'études LIMAIR - La Surveillance de l'Air en Limousin http://www.limair.asso.fr ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] Error running fTools_preview2/Random points
Barry, After entering the output file name and clicking OK in the fTools_preview2/Random points panel I get the following error (binary ubuntu preview2 version): An error has occured while executing Python code: Traceback (most recent call last): File /home/alobo/.qgis/python/plugins/fTools_preview2/tools/doRandPoints.py, line 123, in accept self.randomize(inLayer, outPath, minimum, design, value, self.progressBar) File /home/alobo/.qgis/python/plugins/fTools_preview2/tools/doRandPoints.py, line 269, in randomize points = self.simpleRandom(int(value), bound, ext.xMin(), ext.xMax(), ext.yMin(), ext.yMax()) AttributeError: xMin Also, most of the options except Use this number of points are greyed and cannot be filed. Thanks! Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] QGIS Python Plugin Installer not UTF-8 aware?
2008/11/17 Borys Jurgiel [EMAIL PROTECTED]: def description(): return u'Danke schön' However... Installer do, but rest of QGIS doesn't support utf-8 in plugin metadata ;) I've fixed that in SVN trunk, from r9663 it supports also metadata in unicode :) Martin ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] Error running fTools_preview2/Random points
Hi Agus, After entering the output file name and clicking OK in the fTools_preview2/Random points panel I get the following error (binary ubuntu preview2 version): This is an error due to the recent api changes... These must have been made after I updated fTools, and I missed it :-( Sorry about that, I'll try to fix that as soon as possible. Cheers, Carson -- Carson Farmer National Centre for Geocomputation John Hume Building, National University of Ireland, Maynooth, Maynooth, Co. Kildare, Ireland. ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
[Qgis-user] getting QgsMapCanvasSnapper to work
Hi all! I'm trying to snap a vertex with my python plugin. (Many thanks to Martin for the quick work with the bindings!) My code looks like this: def canvasReleaseEvent(self,event): x = event.pos().x() y = event.pos().y() startingPoint = QPoint(x,y) result = [] excludePoints = [] snapper = QgsMapCanvasSnapper(self.canvas) snapper.snapToCurrentLayer (startingPoint,result,QgsSnapper.SnapToVertex, 1, excludePoints) print result: ,result The problem is, whatever I do, the result keeps empty. I tried to play with tolerance and scale and I'm quite sure it has to find a vertex but without any success (the layer unit is meter). So I thought about using QgsSnapper directly. But I'm not able to set it up properly. Doing the following snippet always leads to a attribut error on the snapLayer struct. snapLayer = QgsSnapper.SnapLayer snapLayer.mLayer = self.iface.mapCanvas().currentLayer() snapLayer.mTolerance = 1000 snapLayer.mSnapTo = QgsSnapper.SnapToVertex So, if anyone has a hint why the QgsMapCanvasSnapper doesn't want to give me a result or how I set up the struct correctly, it would be wonderful to share it with me :-) Best regards and kudos to all the helping people here on the list! Cédric mit freundlichen Grüssen Cédric Möri GIS-Informatiker -- Kanton Solothurn Bau- und Justizdepartement Amt für Geoinformation Rötistrasse 4 4501 Solothurn Telefon: +41 (0)32 627 24 75 Telefax: +41 (0)32 627 22 14 mailto:[EMAIL PROTECTED] http://www.agi.so.ch ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] getting QgsMapCanvasSnapper to work
Here's what I do for snapping in python: def canvasReleaseEvent(self, e): print mouse click, e mapcoords = self.canvas.getCoordinateTransform().toMapCoordinates(e.x(), e.y()) print map position, mapcoords snapdist = 2 r = qgis_utils.snap(self.layer, mapcoords, QgsSnapper.SnapToVertexAndSegment, snapdist=0.3) if r != None: fid = r.snappedAtGeometry self.emit(SIGNAL(selectedFeature(int)), (fid)) def snap(layer, point, snaptype, snapdist=1): print \nsnapping x, reslist = layer.snapWithContext(point, snapdist, snaptype) print x, x if x != 0: return None return getBestSnapResult(reslist) def getBestSnapResult(snapresult): print result, snapresult keys = snapresult.keys() keys.sort() for k in keys: l = snapresult[k] for r in l: return r It works, but not great. It doesn't always get a snap result, even when I think it really should. I think part of the problem is that I'm using a fixed snapdist no matter what the zoom level is... but I haven't looked at it closely. Möri Cedric pisze: Hi all! I'm trying to snap a vertex with my python plugin. (Many thanks to Martin for the quick work with the bindings!) My code looks like this: def canvasReleaseEvent(self,event): x = event.pos().x() y = event.pos().y() startingPoint = QPoint(x,y) result = [] excludePoints = [] snapper = QgsMapCanvasSnapper(self.canvas) snapper.snapToCurrentLayer (startingPoint,result,QgsSnapper.SnapToVertex, 1, excludePoints) print result: ,result The problem is, whatever I do, the result keeps empty. I tried to play with tolerance and scale and I'm quite sure it has to find a vertex but without any success (the layer unit is meter). So I thought about using QgsSnapper directly. But I'm not able to set it up properly. Doing the following snippet always leads to a attribut error on the snapLayer struct. snapLayer = QgsSnapper.SnapLayer snapLayer.mLayer = self.iface.mapCanvas().currentLayer() snapLayer.mTolerance = 1000 snapLayer.mSnapTo = QgsSnapper.SnapToVertex So, if anyone has a hint why the QgsMapCanvasSnapper doesn't want to give me a result or how I set up the struct correctly, it would be wonderful to share it with me :-) Best regards and kudos to all the helping people here on the list! Cédric mit freundlichen Grüssen Cédric Möri GIS-Informatiker -- Kanton Solothurn Bau- und Justizdepartement Amt für Geoinformation Rötistrasse 4 4501 Solothurn Telefon: +41 (0)32 627 24 75 Telefax: +41 (0)32 627 22 14 mailto:[EMAIL PROTECTED] http://www.agi.so.ch ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user x ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
AW: [Qgis-user] getting QgsMapCanvasSnapper to work
Hi Cedric I used your code lines and started the debugger. It seems that the QgsMapCanvasSnapper works correctly. I think the problem has to do with the QList reference in the binding: int snapToCurrentLayer( const QPoint p, QListQgsSnappingResult results, QgsSnapper::SnappingType snap_to, double snappingTol = -1, const QListQgsPoint excludePoints = QListQgsPoint() ); I tried to change that to: int snapToCurrentLayer( const QPoint p, QListQgsSnappingResult results /Out/, QgsSnapper::SnappingType snap_to, double snappingTol = -1, const QListQgsPoint excludePoints = QListQgsPoint() ); But then Python complains about a wrong type of the results parameter with your code. I tried to use a 'QList' instead of '[]', but it seems there is no QList in PyQt? Python experts: How can we deal with QList in PyQGIS? Regards, Marco -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] im Auftrag von Möri Cedric Gesendet: Di 18.11.2008 18:43 An: qgis-user@lists.osgeo.org Betreff: [Qgis-user] getting QgsMapCanvasSnapper to work Hi all! I'm trying to snap a vertex with my python plugin. (Many thanks to Martin for the quick work with the bindings!) My code looks like this: def canvasReleaseEvent(self,event): x = event.pos().x() y = event.pos().y() startingPoint = QPoint(x,y) result = [] excludePoints = [] snapper = QgsMapCanvasSnapper(self.canvas) snapper.snapToCurrentLayer (startingPoint,result,QgsSnapper.SnapToVertex, 1, excludePoints) print result: ,result The problem is, whatever I do, the result keeps empty. I tried to play with tolerance and scale and I'm quite sure it has to find a vertex but without any success (the layer unit is meter). So I thought about using QgsSnapper directly. But I'm not able to set it up properly. Doing the following snippet always leads to a attribut error on the snapLayer struct. snapLayer = QgsSnapper.SnapLayer snapLayer.mLayer = self.iface.mapCanvas().currentLayer() snapLayer.mTolerance = 1000 snapLayer.mSnapTo = QgsSnapper.SnapToVertex So, if anyone has a hint why the QgsMapCanvasSnapper doesn't want to give me a result or how I set up the struct correctly, it would be wonderful to share it with me :-) Best regards and kudos to all the helping people here on the list! Cédric mit freundlichen Grüssen Cédric Möri GIS-Informatiker -- Kanton Solothurn Bau- und Justizdepartement Amt für Geoinformation Rötistrasse 4 4501 Solothurn Telefon: +41 (0)32 627 24 75 Telefax: +41 (0)32 627 22 14 mailto:[EMAIL PROTECTED] http://www.agi.so.ch ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user
Re: [Qgis-user] getting QgsMapCanvasSnapper to work
I used your code lines and started the debugger. It seems that the QgsMapCanvasSnapper works correctly. I think the problem has to do with the QList reference in the binding: int snapToCurrentLayer( const QPoint p, QListQgsSnappingResult results, QgsSnapper::SnappingType snap_to, double snappingTol = -1, const QListQgsPoint excludePoints = QListQgsPoint() ); I wonder if this is related to a similar problem I was having with python bindings for uniqueValues on QgsVectorDataProvider? But then Python complains about a wrong type of the results parameter with your code. I tried to use a 'QList' instead of '[]', but it seems there is no QList in PyQt? Python experts: How can we deal with QList in PyQGIS? Short answer: you should be able to use a python list in place of a QList Regards, Marco -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] im Auftrag von Möri Cedric Gesendet: Di 18.11.2008 18:43 An: qgis-user@lists.osgeo.org Betreff: [Qgis-user] getting QgsMapCanvasSnapper to work Hi all! I'm trying to snap a vertex with my python plugin. (Many thanks to Martin for the quick work with the bindings!) My code looks like this: def canvasReleaseEvent(self,event): x = event.pos().x() y = event.pos().y() startingPoint = QPoint(x,y) result = [] excludePoints = [] snapper = QgsMapCanvasSnapper(self.canvas) snapper.snapToCurrentLayer (startingPoint,result,QgsSnapper.SnapToVertex, 1, excludePoints) print result: ,result The problem is, whatever I do, the result keeps empty. I tried to play with tolerance and scale and I'm quite sure it has to find a vertex but without any success (the layer unit is meter). So I thought about using QgsSnapper directly. But I'm not able to set it up properly. Doing the following snippet always leads to a attribut error on the snapLayer struct. snapLayer = QgsSnapper.SnapLayer snapLayer.mLayer = self.iface.mapCanvas().currentLayer() snapLayer.mTolerance = 1000 snapLayer.mSnapTo = QgsSnapper.SnapToVertex So, if anyone has a hint why the QgsMapCanvasSnapper doesn't want to give me a result or how I set up the struct correctly, it would be wonderful to share it with me :-) Best regards and kudos to all the helping people here on the list! Cédric mit freundlichen Grüssen Cédric Möri GIS-Informatiker -- Kanton Solothurn Bau- und Justizdepartement Amt für Geoinformation Rötistrasse 4 4501 Solothurn Telefon: +41 (0)32 627 24 75 Telefax: +41 (0)32 627 22 14 mailto:[EMAIL PROTECTED] http://www.agi.so.ch ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user -- Carson Farmer National Centre for Geocomputation John Hume Building, National University of Ireland, Maynooth, Maynooth, Co. Kildare, Ireland. www.carsonfarmer.com ___ Qgis-user mailing list Qgis-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user