Re: [Qgis-developer] Python: Union selected polygons in a layer

2013-10-06 Thread Marco Bernasocchi
Hi Andi in inasafe i do something similar [0] Please be warned that it is in the messyest part of our code :) Ciao [0] https://github.com/AIFDR/inasafe/blob/master/safe_qgis/impact_statistics/aggregator.py#L1046 Hi, I am trying to union selected geometries in a layer into one geometry. A

Re: [Qgis-developer] Python: Union selected polygons in a layer

2013-10-05 Thread Daniel
Try the QgsGeometry::combine() method. http://www.qgis.org/api/classQgsGeometry.html#a63244d3435cc99794b82a6cbd0af0eb5 Quoting class doc *Note:*this operation is not called union since its a reserved word in C++. On Sat, Oct 5, 2013 at 8:07 AM, gene martin.lal...@gmail.com wrote: I also do

Re: [Qgis-developer] Python: Union selected polygons in a layer

2013-10-05 Thread gene
Finally, I found the solution: it is *geom.combine(another_geom)* and not union, why ? gLine = QgsGeometry.fromPolyline( [ QgsPoint(1,1), QgsPoint(2,2) ] ) gLine2 = QgsGeometry.fromPolyline( [ QgsPoint(1,2), QgsPoint(2,1) ]) gLine2.combine(gLine).exportToGeoJSON() u'{ type:

Re: [Qgis-developer] Python: Union selected polygons in a layer

2013-10-05 Thread gene
Ok, the reply is this operation is not called union since its a reserved word in C++. Thanks to Daniel-2, we post at the same time. -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Python-Union-selected-polygons-in-a-layer-tp5081862p5081967.html Sent from the

Re: [Qgis-developer] Python: Union selected polygons in a layer

2013-10-05 Thread Andreas Neumann
Hi Daniel, Thanks - this should do the trick! And it explains why I did not find Union. Will try on Monday when I am back in the office. Andreas Am 05.10.2013 11:55, schrieb Daniel: Try the QgsGeometry::combine() method.

[Qgis-developer] Python: Union selected polygons in a layer

2013-10-04 Thread Andreas Neumann
Hi, I am trying to union selected geometries in a layer into one geometry. A multpolygon as a result would be fine if the selected polygons aren't contiguous. I did not find a union command in the API. How can I do this from Python? Thanks a lot for any hints! Andreas