[Qgis-developer] Python QGis Geometry.transform

motta.luiz at gmail.com motta.luiz at gmail.com
Fri Dec 4 13:16:41 EST 2009


Hi All,

May be useful to someone this function.
I make a function to change reference system of geometry.
It was used to substitute the lack 
QgsGeometry::transform(const QgsCoordinateTransform)
for Python.

def __transformGeometry(self, geom, coordTrans):
  """
  geom: core.QgsGeometry to be Transform by coordTrans
  coordTrans: core.QgsCoordinateTransform
  """
  for i in range(geom.exportToWkt().count(',')):
    vertex = coordTrans.transform(geom.vertexAt(i))
    geom.moveVertex(vertex.x(), vertex.y(), i)


Luiz



More information about the Qgis-developer mailing list