[QGIS-Developer] PyQgis QgsCoordinateTransform constructor?

Richard Duivenvoorde rdmailings at duif.net
Thu Dec 21 23:44:53 PST 2017


Hi Devs,

since ages, I use like the following to create/get 2
QgsCoordinateReferenceSystem's , then create a QgsCoordinateTransform
from those and transform geoms or points:

crs = iface.mapCanvas().mapSettings().destinationCrs()
print(type(crs))
print(crs.srsid())
print(crs.toWkt())

crs2 = QgsCoordinateReferenceSystem()
crs2.createFromId(4326)
print(type(crs2))
print(crs2.srsid())
print(crs2.toWkt())

crsTransform = QgsCoordinateTransform(crs2, crs)

But since some time (test in python console):

Traceback (most recent call last):
  File "/usr/lib/python3.6/code.py", line 91, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "<string>", line 10, in <module>
TypeError: QgsCoordinateTransform(): arguments did not match any
overloaded call:
  overload 1: too many arguments
  overload 2: not enough arguments
  overload 3: not enough arguments
  overload 4: not enough arguments
  overload 5: argument 1 has unexpected type 'QgsCoordinateReferenceSystem'

While the api

https://qgis.org/api/classQgsCoordinateTransform.html#a8c036726885d51e9fdfe1478a063dfcd

still notes this constructor?

Do I miss info? Or is something wrong with my sip stuff?

Regards,

Richard Duivenvoorde



More information about the QGIS-Developer mailing list