Bug report #18348

QgsCoordinateTransform still has a problem

Added by Dan Klimek over 2 years ago. Updated over 2 years ago.

Status:Closed
Priority:High
Assignee:-
Category:PyQGIS Console
Affected QGIS version:3.1(master) Regression?:No
Operating System:Windows 10 Easy fix?:No
Pull Request or Patch supplied:No Resolution:invalid
Crashes QGIS or corrupts data:No Copied to github as #:26238

Description

The problem seems the same (or similar) to Bug report #17833

Executing the following commands in the python console (taken from the https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/crs.html?highlight=qgscoordinatetransform example for Projections)

crsSrc = QgsCoordinateReferenceSystem(4326) # WGS 84
crsDest = QgsCoordinateReferenceSystem(32633) # WGS 84 / UTM zone 33N
xform = QgsCoordinateTransform(crsSrc, crsDest)

results in :

Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, 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'

QGIS version
3.1.0-Master
QGIS code revision
871132eae6
Compiled against Qt
5.9.2
Running against Qt
5.9.2
Compiled against GDAL/OGR
2.2.3
Running against GDAL/OGR
2.2.3
Compiled against GEOS
3.5.0-CAPI-1.9.0
Running against GEOS
3.5.0-CAPI-1.9.0 r4084
PostgreSQL Client Version
9.2.4
SpatiaLite Version
4.3.0
QWT Version
6.1.3
QScintilla2 Version
2.10.1
PROJ.4 Version
493
This copy of QGIS writes debugging output.

History

#1 Updated by Nyall Dawson over 2 years ago

  • Resolution set to invalid
  • Status changed from Open to Closed

That's 2.x API.

transform = QgsCoordinateTransform( src, dest, QgsProject.instance())

Also available in: Atom PDF