[QGIS-Developer] QGIS3: QgsCoordinateTransform Error

Richard Duivenvoorde rdmailings at duif.net
Fri Dec 22 08:59:15 PST 2017


See my email earlier today :-)

In short use:

        canvasCrs = self.canvas.mapSettings().destinationCrs()
        transform = QgsCoordinateTransform(
			epsg4326, canvasCrs, QgsProject.instance())
        x, y = transform.transform(float(lon), float(lat))

https://github.com/qgis/QGIS/blob/master/src/core/qgscoordinatetransform.h#L75

Regards,

Richard Duivenvoorde

On 22-12-17 17:06, C Hamilton wrote:
> I'm not sure what to do with this API break for my QGIS 3 plugin. Can
> anyone explain what is wrong and what needs to change or is this a bug?
> This showed up with QGIS 3 version 2.99.0-245. In my code I have  the
> following:
> 
>         canvasCrs = self.canvas.mapSettings().destinationCrs()
>         transform = QgsCoordinateTransform(epsg4326, canvasCrs)
>         x, y = transform.transform(float(lon), float(lat))
> 
> I get this error:
> 
> Traceback (most recent call last):
>   File
> "C:/Users/.../AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\latlontools\multizoom.py",
> line 371, in canvasPointXY
>     transform = QgsCoordinateTransform(epsg4326, canvasCrs)
> 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'
> 
> Thanks,
> 
> Calvin
> 
> 
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> 



More information about the QGIS-Developer mailing list