[Qgis-developer] Error for use Coordinate Transform

Martin Dobias wonder.sk at gmail.com
Wed Jan 19 14:23:08 EST 2011

On Mon, Jan 17, 2011 at 3:36 AM, Luiz Motta <motta.luiz at gmail.com> wrote:
> Hi Devs,
> I am making the plugin, where i use this method
> "core.QgsCoordinateTransform.transform", the QGis showed dialog error.
> I tested by Python console and the same error showed.
> The script to run on python console:
> from qgis import core
> mapCanvas = qgis.utils.iface.mapCanvas()
> srsCanvas = mapCanvas.mapRenderer().destinationSrs()
> srsGoogle = core.QgsCoordinateReferenceSystem(900913,
> core.QgsCoordinateReferenceSystem.EpsgCrsId)
> pntCenter = mapCanvas.extent().center()
> print pntCenter
> coodTrans = core.QgsCoordinateTransform(srsCanvas, srsGoogle)
> pntCenter = coodTrans.transform(pntCenter,
> core.QgsCoordinateTransform.ForwardTransform) # Error showed here!
> print pntCenter
> Message error:
> Title dialog : Exception
> Text message:
> forward transform(-0.832741, -0.274682)
> failed with error: No such file or directory


what is the map canvas CRS you have been using? The error message you
got was an unhandled projection exception (impossible to catch in
python). The error suggests that some file that proj4 needs is
missing. However you shouldn't need to init anything. On windows we
explicitly set where the proj4 files should be (see


More information about the Qgis-developer mailing list