Closed qgib closed 5 years ago
Author Name: Denis Rouzaud (@3nids)
can you share more of the code, especially the definition of transform, and provide a minimal code example?
Author Name: Russell Fulton (Russell Fulton)
I have done more investigation and the situations is not quite what I thought. It turns out that that transform gets called successfully lots of times before failing. Once I figured that out i looked at the point that was being transformed since the problem did not appear to be with the transform itself ( my bad for not checking this before).
wp is a waypoint from gpxpy
new_point = QgsPoint( wp.longitude, wp.latitude)
print( 'debug 1 wp:', wp, 'point:', new_point, ", tr:", tr)
new_point.transform(tr)
last line printed before crash:
debug 1 wp: [wpt{T E B05}:0.0,0.0@None] point: <qgis._core.QgsPoint object at 0x113b17ee8> , tr: <qgis._core.QgsCoordinateTransform object at 0x113b9a0d8>
It looks like the waypoint from the GPX file is 0,0 -- the transform is from 4326 to 2193
Author Name: Denis Rouzaud (@3nids)
Just tried this code
@cfrom=QgsCoordinateReferenceSystem.fromEpsgId(4326) cto=QgsCoordinateReferenceSystem.fromEpsgId(2193) p=QgsPoint(0,0) t=QgsCoordinateTransform(cfrom,cto,QgsProject.instance()) p.transform(t)@
I don't get a crash but an exception
@_core.QgsCsException: forward transform of (0.000000, 0.000000) PROJ: +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 +to +proj=tmerc +lat_0=0 +lon_0=173 +k=0.9996 +x_0=1600000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs Error: latitude or longitude exceeded limits@
But I think that it might be indeed a crash in 3.0, I am on master (upcoming 3.4).
You might want to do a try...except in Python to handle this.
Author Name: Denis Rouzaud (@3nids)
I mark it as fixed as the exception is the foreseen effect.
Author Name: Russell Fulton (Russell Fulton) Original Redmine Issue: 18915 Affected QGIS version: 3.0.2 Redmine category:pythonbindings/_sipify Assignee: Denis Rouzaud
I believe that this worked in 3.0.0 and 3.0.1 (once I converted the API calls to 3.0)
Call to transform dies with "Exception: unknown":