[Qgis-developer] Qgis crash after transforming invalid coordinates

Goo Creations goocreations at gmail.com
Tue Apr 5 02:33:07 EDT 2011


Hi all

I'm doing the following to transform coordinates:

*ct = QgsCoordinateTransform()*
*ct.setSourceCrs(sourceCRS)*
*ct.setDestCRS(destinationCRS)*
*point1 = ct.transform(aPoint)*

Everything works fine, until the users enters coordinates that are invalid
for the source CRS. Qgis crashes with the following errors:

*qgscoordinatetransform.cpp: 485: (transformCoords) Projection failed
emitting invalid transform signal: forward transform of (44038.4, -33923.3)*
*failed with error: latitude or longitude exceeded limits*

*qgscoordinatetransform.cpp: 489: (transformCoords) throwing exception*
*qgscoordinatetransform.cpp: 226: (transform) rethrowing exception*
*terminate called after throwing an instance of 'QgsCsException'*
*Aborted*

I've tried to catch *QgsCsException, *but *qgscoordinatetransform *still
terminates Qgis before the exception can be caught.
I've also tried connecting the
invalidTransformInput<http://doc.qgis.org/stable/classQgsCoordinateTransform.html#3aef3d008b1f5fad21aeb0f8930fdd38>()
signal, which successfully executes (but Qgis is still terminated
afterwards).

Is there a way to test the coordinates before trying to transform them,
since I will be out of my control what the user enters? I can't find
anything in QgsCoordinateTransform.

Thank you

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110405/ab5e94ba/attachment.html


More information about the Qgis-developer mailing list