[Qgis-developer] Error for use Coordinate Transform

Luiz Motta motta.luiz at gmail.com
Wed Jan 19 18:41:23 EST 2011


Martin,

Thank´s for  your message.

I read the source:
http://doc.qgis.org/head/qgscoordinatetransform_8cpp-source.html#l00558

const char *finder( const char *name )
{
  QString proj;
#ifdef WIN32
  proj = QApplication::applicationDirPath()
         + "/share/proj/" + QString( name );
#endif
  return proj.toUtf8();
}

I tested the  value of proj in console:

from PyQt4 import QtCore, QtGui
print  QtGui.QApplication.applicationDirPath()

The out in my enviroment is
" C:\OSGeo4W\apps\qgis-dev\bin",
for my friend is
"C:/PROGRA~1/QUANTU~2/apps/qgis/bin"

For me, i created and copied directory, from "C:\OSGeo4W\share\proj" to "
C:\OSGeo4W\apps\qgis-dev\bin\share\proj"

With this the problem in windows is resolved.

Need change the  source of path proj in method "const char *finder( const
char *name )" or make the  review where have the first setting the directory
for Proj,
 because, when i still  use the plugin, the directory was setting correct

Regards,
Luiz


2011/1/19 Martin Dobias <wonder.sk at gmail.com>

> 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
>
> Luiz,
>
> 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
> QgsCoordinateTransform::setFinder).
>
> Martin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20110119/912177bd/attachment.html


More information about the Qgis-developer mailing list