[Qgis-developer] How to scale a polygon from pyQgis

2015-02-06 Thread Geo DrinX
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 =

Re: [Qgis-developer] How to scale a polygon from pyQgis

2015-02-06 Thread Martin Dobias
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()