[Qgis-developer] Improved Random Point request (for dot density maps)
For the Vector - Research Tools - Random Point - Stratified sampling design, can we have: Add Proportional Value From Input Field selection, where the user can select a floating point field, and then they could enter either: 1) Number of points on map, or 2) Value of each point. If the user selects number of points, the algorithm would sum the positive numbers in all the polygons, and sum the absolute value of the negative numbers, and divide the max of these two sums by the number of points specified, to get the value-per-point. (E.g. if the user specified 1000 points, it would yield no more than 1000 points representing positive values, and no more than 1000 points representing negative values.) Then the algorithm would iterate through the polygons and for each polygon would divide the absolute value of the user specified field by the value-per-point, round it to the nearest integer, and place that many random points in the polygon. Each point would be labeled by the value of the field divided by the number of points. Advantages over current Random Point - Use value from Input Field: 1) Don't have to generate a new field representing the number of points, if you have a field representing something big and continuous, like Gross Domestic Product per state. 2) Don't have to figure out the value of each point in advance, can specify that you want 1000 points (for positive values) and get 1000 points generated. 3) Generates negative values as well as positive values (I often use blue dots for increases and red dots for decreases in dot-density maps.) 4) Random points are assigned a quantity such that the original value can be retrieved with a sum (i.e. although the number of dots is necessarily rounded to an integer, the attribute on the dot values can vary between the different polygons.) (Unless zero points are generated in the polygon.) 5) (related) works on floating point fields. PS I have this working well in PostGIS and have used it for years. Function attached. It's just annoying to use if the data aren't in PostGIS already, and I'd like to rest of the QGIS community to have this cool functionality. I always thought I'd implement this myself in QGIS code, but I'm starting to realize that I'm neck-deep in too many coding projects right now. However I would buy beer or pay someone to implement this, if it helps speed it along. -- John Abraham AddDotDensity.sql Description: Binary data ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] [Qgis-user] Poor performance with large projects
I can confirm this issue. I've the same problem when work with my complex projects. I'm not a developer so I can't propose a solution but I'm available for testing. Luca 2015-02-06 9:52 GMT+01:00 Sam Ingarfield sjfingarfi...@gmail.com: Hi Everyone, I have been suffering from *very* poor performance on a number of projects, which only seems to become noticeable on large, complex projects. I have filed a bug with regards to this, see http://hub.qgis.org/issues/12125. Giovanni suggested I cross-post on the developer and user lists to see if others are experiencing the problem/have any ideas on what's going on. The issue I am experiencing manifests in two ways: a) Very slow project loading times (30mins at times). Someone on the bug tracker suggested that this may in part be related to the retrieval of extent and geometry from postgis layers. I've had a look at the debugging logs (from the master build) and this seems to be the case, for what I estimate as about half the loading time. b) Very slow addition and removal of layers after the first save event. From a quick look at the debug output, it seems that after the first save, the entire project is being reloaded on each layer addition/removal, which takes a very long time. Before the first save event, performance is very good, addition and removal of layers is virtually instantaneous. Obviously long project times are annoying but manageable, so long as I only have to load the project infrequently. The second issue, however, makes Qgis pretty much unworkable and leads to very long times between saves (and the inevitable quit reload to restore performance) which is poor practice. To give you an idea of the difference between pre and post-save behaviour, Qgis emits about 850 lines of debugging output pre-save, rising to over 430,000 lines post-save when adding a layer to one of my projects. Am happy to share debugging output with a developer off-list if that would help nail down what is happening and could lead to a fix. Cheers; Sam Ingarfield. ___ Qgis-user mailing list qgis-u...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-user ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Error import Processing
Hi I am working with QGIS Valmiera 2.2.0 in a Windows 7. I need import the library Processing, but I can't load. My code is as follow: import sysimport qgisfrom qgis.core import *from qgis.utils import *from qgis.gui import *from PyQt4.QtCore import *from PyQt4.QtGui import *app = QApplication([])QgsApplication.setPrefixPath(C:\\Users,True)QgsApplication.initQgis()import processingfrom processing.core.Processing import Processingprocessing.initialize()from processing.lidar.lastools.LAStoolsUtils import LAStoolsUtilsProcessing.initialize()processing.alglist('lasview')import osimport subprocessimport csvprint Cargamos as librerias if len(sys.argv) 3:print Faltan parametros de entradaelse: temporal=sys.argv[2]ficheros=[]t=0for p in range(3,len(sys.argv)): ficheros.insert(t,sys.argv[p])t=t+1 ficherosTemp = os.listdir(temporal)if('procesado.txt' in ficherosTemp): lista_input=os.path.join(temporal,'procesado.txt') lista=open(lista_input,'r')lista_txt=lista.readlines()for t in range(len(lista_txt)):lista_txt[t]=lista_txt[t].replace('\n','') lista.close()imag2=list(set(ficheros)-set(lista_txt)) lista_output=temporal+os.sep+procesado.txt lista=open(lista_output,'w') lista.writelines('\n'.join(lista_txt+imag2))lista.close()else: print no existe el fichero procesado.txt lista_output=temporal+os.sep+procesado.txt lista=open(lista_output,'w')lista.writelines('\n'.join(ficheros)) lista.close()imag2=ficheros for archivo1 in imag2:(Ruta,arch)=os.path.split(archivo1) output_file=os.path.join(temporal,'ground'+arch) processing.runalg('lidartools:lasground','False',archivo1,'False','False','True',1,1,output_file) input_file=output_file output_file=os.path.join(temporal,'height'+arch) processing.runalg('lidartools:lasheight','False',input_file,'False',output_file) os.remove(input_file)input_file=output_file output_file=os.path.join(temporal,'classify'+arch) processing.runalg('lidartools:lasclassify','False',input_file,'False','False',output_file) os.remove(input_file)input_file=output_file.split(os.sep) input_file='/'.join(input_file)output_file=temporal.split(os.sep) output_file='/'.join(output_file)+'/'+arch+'out1.LAS' commands=[LAStoolsUtils.LAStoolsPath()+'/bin/lasheight','-i',input_file,'-o',output_file,'-classify_between','15','55','8','-ignore_class','2','5','6','-scale_u','1.0'] commandline= .join(commands) proc=subprocess.Popen(commandline,shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.STDOUT,universal_newlines=False) proc.stdout.read()proc.stdout.close() os.remove(input_file)input_file=output_file output_file=temporal.split(os.sep) output_file='/'.join(output_file)+'/'+arch+'out.txt' commands=[LAStoolsUtils.LAStoolsPath()+'/bin/las2txt','-i',input_file,'-o',output_file,'-keep_class','8','-parse','xyzu'] commandline= .join(commands) proc=subprocess.Popen(commandline,shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE,stderr=subprocess.STDOUT,universal_newlines=False) proc.stdout.read()proc.stdout.close()for archivo1 in imag2:(Ruta,arch)=os.path.split(archivo1) file_delete=temporal.split(os.sep) file_delete='/'.join(file_delete)+'/'+arch+'out1.LAS' os.remove(file_delete) print hemos eliminado los archivos sobrantesif('out.txt' in ficherosTemp):txt_file=temporal+os.sep+out.txt output=open(txt_file,'a')out_txt=csv.writer(output,delimiter=;) for archivo2 in imag2:(Ruta,arch2)=os.path.split(archivo2) input_file=os.path.join(temporal,arch2+'out.txt') input=open(input_file,'r')in_txt=csv.reader(input,delimiter=' ') file_list=list(in_txt)for row in file_list: out_txt.writerow(row)input.close()os.remove(input_file) output.close()else:txt_file=temporal+os.sep+out.txt output=open(txt_file,'w') out_txt=csv.writer(output,delimiter=;) nombres=['X','Y','Elevacion','Altura']out_txt.writerow(nombres) for archivo2 in imag2:(Ruta,arch2)=os.path.split(archivo2) input_file=os.path.join(temporal,arch2+'out.txt') input=open(input_file,'r')in_txt=csv.reader(input,delimiter=' ') file_list=list(in_txt)for row in file_list: out_txt.writerow(row)input.close()os.remove(input_file) output.close()csv_file=temporal+os.sep+out.csv output=open(csv_file,'wb')
[Qgis-developer] How to scale a polygon from pyQgis
Hello, I need to scale a polygon from python code. An extract of source code is the following : for feat in iter: geom = feat.geometry() rect = geom.boundingBox() x1 = rect.xMinimum() y1 = rect.yMinimum() x2 = rect.xMaximum() y2 = rect.yMinimum() xc = (x2 + x1) / 2.0 yc = (y2 + y1) / 2.0 elem = geom.asPolygon() fat = float(scale) / 100. for i in range(geom.exportToWkt().count(',')): vertex = geom.vertexAt(i) x,y = vertex.x(), vertex.y() xR, yR = x-xc , y-yc xS, yS = xR*fat, yR*fat xT, yT = xS + xc, yS + yc geom.moveVertex(xT, yT, i) Because the polygon do not change, sure I miss something, to save the modified element, also if the layer is in editing. Someone could help me to understand what I wrong ? Thank you Roberto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Strange behaviour in feature ids when editing PostGIS layer
Correct, no PK in my table. What you say sounds feasible. I will try with another table that has a PK, and see if I can reproduce the error or not. I cannot expect to have a PK in the user's table, but this is at least a clue :-) Thanks! 2015-02-06 12:48 GMT+01:00 Martin Dobias wonder...@gmail.com: Hi Victor On Fri, Feb 6, 2015 at 5:39 PM, Victor Olaya vola...@gmail.com wrote: In the case of a PostGIS layer, when the editingStopped signal is emitted, the query will return no features. The feature with id 1 is no longer there, and instead there will be a feature with id equal to 4. So basically it seems that a modification of a feature is really a removal and then an addition, and the added feature has a different id than the removed one, Does you table have a primary key? What is the table definition? If the postgres provider can't find a primary key, it will try to use ctid as the ID. Then I think what you say can happen - when updating a row, postgres removes the old row and appends a new one and the ctid will change. Cheers Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] error in compiling (QWTPOLAR_INCLUDE_DIR)
Hi all, I'm not able to compile QGIS. It seems related with QWTPOLAR_INCLUDE_DIR. This is the error when configuring with ccmake: CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: QWTPOLAR_INCLUDE_DIR used as include directory in directory /home/matteo/QGIS-master/src/app used as include directory in directory /home/matteo/QGIS-master/src/app used as include directory in directory /home/matteo/QGIS-master/src/app QWTPOLAR_LIBRARY linked by target qgis in directory /home/matteo/QGIS-master/src/app linked by target qgis_app in directory /home/matteo/QGIS-master/src/app linked by target qgis_qgisappclipboard in directory /home/matteo/QGIS-master/tests/src/app I tried also to set them as OFF but then I got an error with make: /home/matteo/QGIS/src/app/gps/qgsgpsinformationwidget.h:27:28: fatal error: qwt_polar_plot.h: No such file or directory #include qwt_polar_plot.h ^ compilation terminated. src/app/CMakeFiles/qgis.dir/build.make:1201: recipe for target 'src/app/CMakeFiles/qgis.dir/qgisapp.cpp.o' failed make[2]: *** [src/app/CMakeFiles/qgis.dir/qgisapp.cpp.o] Error 1 CMakeFiles/Makefile2:2352: recipe for target 'src/app/CMakeFiles/qgis.dir/all' failed make[1]: *** [src/app/CMakeFiles/qgis.dir/all] Error 2 Makefile:147: recipe for target 'all' failed make: *** [all] Error 2 Sure I'm missing something easy to fix, but I really don't know what.. Thanks guys! Matteo ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Strange behaviour in feature ids when editing PostGIS layer
Hi all, I am seeing a behaviour that surprised me when editing a PostGIS layer. HEre's a detailed explanation Let's say I have a layer with 3 features with ids 1,2 and 3. In a layer such as a shapefile, if you move the feature with the id 1, the geometryChanged signal is fired, with the feature id and the new geometry as parameters. When the editingStopped signal is emitted after editing is finished, you can query the layer to get the feature with that id 1, and it will be there, with the modified geometry. In the case of a PostGIS layer, when the editingStopped signal is emitted, the query will return no features. The feature with id 1 is no longer there, and instead there will be a feature with id equal to 4. So basically it seems that a modification of a feature is really a removal and then an addition, and the added feature has a different id than the removed one, I am sure there must be an explanation for that, based on how PostGIS works, or how the corresponding provider handles the transactions and the id, but this seems to me rather confusing. In this situation (and in case this is not a bug that can't be fixed), how would you implement a mechanism for, whenever a layer is modified, do something later with the modified features?. Storing the ids of the modified features and then using them on the method that is connected to edittingStopped() won't work in this case. Thanks in advance. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] Strange behaviour in feature ids when editing PostGIS layer
Hi Victor On Fri, Feb 6, 2015 at 5:39 PM, Victor Olaya vola...@gmail.com wrote: In the case of a PostGIS layer, when the editingStopped signal is emitted, the query will return no features. The feature with id 1 is no longer there, and instead there will be a feature with id equal to 4. So basically it seems that a modification of a feature is really a removal and then an addition, and the added feature has a different id than the removed one, Does you table have a primary key? What is the table definition? If the postgres provider can't find a primary key, it will try to use ctid as the ID. Then I think what you say can happen - when updating a row, postgres removes the old row and appends a new one and the ctid will change. Cheers Martin ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QGIS for Windows with Qt 4.8?
Hi Giovanni, On Fri, 06. Feb 2015 at 13:11:04 +0100, G. Allegri wrote: At the moment QGIS for Windows is built against Qt 4.7. Only 32bit was still built against 4.7. OSGeo4W 32bit was meanwhile updated to Qt 4.8. Just the 2.6.1 standalone installer wasn't updated after that. The weekly snapshot of master already uses 4.8. Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de QGIS release manager (PSC) GermanyIRC: jef on FreeNode signature.asc Description: Digital signature ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QGIS for Windows with Qt 4.8?
Thanks a lot Jurgen. Il 06/feb/2015 15:40 Jürgen E. j...@norbit.de ha scritto: Hi Giovanni, On Fri, 06. Feb 2015 at 13:11:04 +0100, G. Allegri wrote: At the moment QGIS for Windows is built against Qt 4.7. Only 32bit was still built against 4.7. OSGeo4W 32bit was meanwhile updated to Qt 4.8. Just the 2.6.1 standalone installer wasn't updated after that. The weekly snapshot of master already uses 4.8. Jürgen -- Jürgen E. Fischer norBIT GmbH Tel. +49-4931-918175-31 Dipl.-Inf. (FH) Rheinstraße 13 Fax. +49-4931-918175-50 Software Engineer D-26506 Norden http://www.norbit.de QGIS release manager (PSC) GermanyIRC: jef on FreeNode ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Poor performance with large projects
Hi Everyone, I have been suffering from *very* poor performance on a number of projects, which only seems to become noticeable on large, complex projects. I have filed a bug with regards to this, see http://hub.qgis.org/issues/12125. Giovanni suggested I cross-post on the developer and user lists to see if others are experiencing the problem/have any ideas on what's going on. The issue I am experiencing manifests in two ways: a) Very slow project loading times (30mins at times). Someone on the bug tracker suggested that this may in part be related to the retrieval of extent and geometry from postgis layers. I've had a look at the debugging logs (from the master build) and this seems to be the case, for what I estimate as about half the loading time. b) Very slow addition and removal of layers after the first save event. From a quick look at the debug output, it seems that after the first save, the entire project is being reloaded on each layer addition/removal, which takes a very long time. Before the first save event, performance is very good, addition and removal of layers is virtually instantaneous. Obviously long project times are annoying but manageable, so long as I only have to load the project infrequently. The second issue, however, makes Qgis pretty much unworkable and leads to very long times between saves (and the inevitable quit reload to restore performance) which is poor practice. To give you an idea of the difference between pre and post-save behaviour, Qgis emits about 850 lines of debugging output pre-save, rising to over 430,000 lines post-save when adding a layer to one of my projects. Am happy to share debugging output with a developer off-list if that would help nail down what is happening and could lead to a fix. Cheers; Sam Ingarfield. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] What happened to processing.runalg?
I've just meet the same problem it comes from this commit : https://github.com/qgis/QGIS/commit/956c155e8f45cb1a0fc4c5d6204f607f80edc6b0#diff-111 some imports where removes from processing.__init__.py in context of a pep8 check this is the source of the regression Arnaud Le 06/02/2015 14:41, Tim Sutton a écrit : Hi All Once of our tests in InaSAFE fails against master (see below). Can someone tell me where runalg went, and more broadly which parts of the processing framework can be relied of as API compatible between releases? I guess more and more people will start relying on its API and we should make it clear what the best practice is. Thanks! Regards Tim == ERROR: Test if line aggregation works -- Traceback (most recent call last): File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 596, in test_line_aggregation impact_layer_attributes=impact_layer_attributes) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 338, in _aggregate aggregator.aggregate(impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 527, in aggregate qgis_impact_layer, safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 634, in _aggregrate_vector_impact self._aggregate_line_impact(safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 920, in _aggregate_line_impact res = self.processing.runalg('qgis:intersection', AttributeError: 'module' object has no attribute 'runalg' -- -- Tim Sutton Visit http://kartoza.com http://kartoza.com/ to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net http://freenode.net/ Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QGIS Certification IRC meeting, Thrus 12 Feb, 2015
Thanks Tim, I'll try to be there. giovanni 2015-02-06 16:34 GMT+01:00 Tim Sutton t...@kartoza.com: Hi All We will be holding a meeting on IRC to discuss QGIS training and certification on Thursday 12 Feb 2015 and 14h00 GMT in the channel #qgis-certification. If you have ideas about a certification programme for QGIS, please come along and join us, or submit your ideas but email for discussion in the meeting! Regards Tim -- -- Tim Sutton Visit http://kartoza.com to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- Giovanni Allegri http://about.me/giovanniallegri Twitter: https://twitter.com/_giohappy_ blog: http://blog.spaziogis.it GEO+ geomatica in Italia http://bit.ly/GEOplus ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] QGIS for Windows with Qt 4.8?
At the moment QGIS for Windows is built against Qt 4.7. Qt 4.8 has solved various minor issues, like with SVG rendering inside a QWebPage, which still affects QGIS 2.6. Will QGIS 2.8 be built with Qt 4.8? giovanni ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] What happened to processing.runalg?
the core methods should not change...and definitely not the runalg method, which is likely to be the most important one. This is clearly a blocker and has to be reverted. 2015-02-06 14:52 GMT+01:00 Arnaud Morvan arnaud.mor...@camptocamp.com: I've just meet the same problem it comes from this commit : https://github.com/qgis/QGIS/commit/956c155e8f45cb1a0fc4c5d6204f607f80edc6b0#diff-111 some imports where removes from processing.__init__.py in context of a pep8 check this is the source of the regression Arnaud Le 06/02/2015 14:41, Tim Sutton a écrit : Hi All Once of our tests in InaSAFE fails against master (see below). Can someone tell me where runalg went, and more broadly which parts of the processing framework can be relied of as API compatible between releases? I guess more and more people will start relying on its API and we should make it clear what the best practice is. Thanks! Regards Tim == ERROR: Test if line aggregation works -- Traceback (most recent call last): File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 596, in test_line_aggregation impact_layer_attributes=impact_layer_attributes) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 338, in _aggregate aggregator.aggregate(impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 527, in aggregate qgis_impact_layer, safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 634, in _aggregrate_vector_impact self._aggregate_line_impact(safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 920, in _aggregate_line_impact res = self.processing.runalg('qgis:intersection', AttributeError: 'module' object has no attribute 'runalg' -- -- Tim Sutton Visit http://kartoza.com to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing listQgis-developer@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] How to scale a polygon from pyQgis
Hi From QGIS 2.8 there is QgsGeometry.transform() method that works with QTransform. The following code will scale the sample line segment: from PyQt4.QtGui import QTransform g = QgsGeometry.fromPolyline([QgsPoint(-1,0),QgsPoint(1,0)]) g.transform( QTransform().scale(2,2) ) print g.asPolyline() The code will print [(-2,0), (2,0)] Cheers Martin On Fri, Feb 6, 2015 at 6:53 PM, Geo DrinX geodr...@gmail.com wrote: Hello, I need to scale a polygon from python code. An extract of source code is the following : for feat in iter: geom = feat.geometry() rect = geom.boundingBox() x1 = rect.xMinimum() y1 = rect.yMinimum() x2 = rect.xMaximum() y2 = rect.yMinimum() xc = (x2 + x1) / 2.0 yc = (y2 + y1) / 2.0 elem = geom.asPolygon() fat = float(scale) / 100. for i in range(geom.exportToWkt().count(',')): vertex = geom.vertexAt(i) x,y = vertex.x(), vertex.y() xR, yR = x-xc , y-yc xS, yS = xR*fat, yR*fat xT, yT = xS + xc, yS + yc geom.moveVertex(xT, yT, i) Because the polygon do not change, sure I miss something, to save the modified element, also if the layer is in editing. Someone could help me to understand what I wrong ? Thank you Roberto ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] What happened to processing.runalg?
Hi All Once of our tests in InaSAFE fails against master (see below). Can someone tell me where runalg went, and more broadly which parts of the processing framework can be relied of as API compatible between releases? I guess more and more people will start relying on its API and we should make it clear what the best practice is. Thanks! Regards Tim == ERROR: Test if line aggregation works -- Traceback (most recent call last): File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 596, in test_line_aggregation impact_layer_attributes=impact_layer_attributes) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 338, in _aggregate aggregator.aggregate(impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 527, in aggregate qgis_impact_layer, safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 634, in _aggregrate_vector_impact self._aggregate_line_impact(safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 920, in _aggregate_line_impact res = self.processing.runalg('qgis:intersection', AttributeError: 'module' object has no attribute 'runalg' -- -- Tim Sutton Visit http://kartoza.com to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] QGIS for Windows with Qt 4.8?
Maybe this is the answer: http://trac.osgeo.org/osgeo4w/wiki/pkg-qt4-libs Il 06/feb/2015 13:11 G. Allegri gioha...@gmail.com ha scritto: At the moment QGIS for Windows is built against Qt 4.7. Qt 4.8 has solved various minor issues, like with SVG rendering inside a QWebPage, which still affects QGIS 2.6. Will QGIS 2.8 be built with Qt 4.8? giovanni ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] QGIS Certification IRC meeting, Thrus 12 Feb, 2015
Hi All We will be holding a meeting on IRC to discuss QGIS training and certification on Thursday 12 Feb 2015 and 14h00 GMT in the channel #qgis-certification. If you have ideas about a certification programme for QGIS, please come along and join us, or submit your ideas but email for discussion in the meeting! Regards Tim -- -- Tim Sutton Visit http://kartoza.com to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
Re: [Qgis-developer] What happened to processing.runalg?
Hi Ah thanks for the feedback Victor and Arnaud! Regards Tim On Fri, Feb 6, 2015 at 3:58 PM, Victor Olaya vola...@gmail.com wrote: the core methods should not change...and definitely not the runalg method, which is likely to be the most important one. This is clearly a blocker and has to be reverted. 2015-02-06 14:52 GMT+01:00 Arnaud Morvan arnaud.mor...@camptocamp.com: I've just meet the same problem it comes from this commit : https://github.com/qgis/QGIS/commit/956c155e8f45cb1a0fc4c5d6204f607f80edc6b0#diff-111 some imports where removes from processing.__init__.py in context of a pep8 check this is the source of the regression Arnaud Le 06/02/2015 14:41, Tim Sutton a écrit : Hi All Once of our tests in InaSAFE fails against master (see below). Can someone tell me where runalg went, and more broadly which parts of the processing framework can be relied of as API compatible between releases? I guess more and more people will start relying on its API and we should make it clear what the best practice is. Thanks! Regards Tim == ERROR: Test if line aggregation works -- Traceback (most recent call last): File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 596, in test_line_aggregation impact_layer_attributes=impact_layer_attributes) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/test/test_aggregator.py, line 338, in _aggregate aggregator.aggregate(impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 527, in aggregate qgis_impact_layer, safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 634, in _aggregrate_vector_impact self._aggregate_line_impact(safe_impact_layer) File /home/timlinux/dev/python/inasafe-dev/safe/impact_statistics/aggregator.py, line 920, in _aggregate_line_impact res = self.processing.runalg('qgis:intersection', AttributeError: 'module' object has no attribute 'runalg' -- -- Tim Sutton Visit http://kartoza.com to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing listQgis-developer@lists.osgeo.orghttp://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer -- -- Tim Sutton Visit http://kartoza.com to find out about open source: * Desktop GIS programming services * Geospatial web development * GIS Training * Consulting Services Skype: timlinux Irc: timlinux on #qgis at freenode.net Tim is a member of the QGIS Project Steering Committee --- Kartoza is a merger between Linfiniti and Afrispatial ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] QgsComposition itemRemoved signal in Python passes a QObject parameter
I haven't enough experience with SIP to spot the problem. Connecting to QgsCompisition itemRemoved signal I obtain a QObject parameter intead of QgsComposerItem. E.g. def something(self): self.composition.itemRemoved.connect(self.itemRemovedFromComposer) def itemRemovedFromComposer(self,*item*): pass the item parameter is a QObject, while the signal signature is void itemRemoved( QgsComposerItem* ) Any help? Thanks, giovanni PS: QObject.connect(self.composition, SIGNAL(( QgsComposerItem* )),self.itemRemovedFromComposer) doesn't work. -- Giovanni Allegri http://about.me/giovanniallegri Twitter: https://twitter.com/_giohappy_ blog: http://blog.spaziogis.it GEO+ geomatica in Italia http://bit.ly/GEOplus ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer