I have written a function that builds a new layer from from a gpx file which is read using pygpx. It runs and the new layer appears in QGIS with all the attributes correct.
Initially I created the layer with a crs of epsg:4326 since the data was lat and lon but when I try and cut and paste the points into my master table I get a message that no points were pasted and no hint why (I have looked in the log).
I now want to try to create the layer in my project crs to see if that fixes the problem but for which I presumably need to transform the points using tr = QgsCoordinateTransform(sourceCrs, destCrs)
as described at Transforming single QgsGeometry object from one CRS to another using PyQGIS?
What I can't figure out is how specify the source and dest crs. I tried supplying strings -- there were no errors but it does not seem to do anything. The call to transform returns 0.
tr = QgsCoordinateTransform('epsg:4326', 'epsg:2193')
...
point = QgsGeometry.fromPoint(QgsPoint( wp.longitude, wp.latitude))
point.transform( tr )
fet.setGeometry( point )