[gdal-dev] importFromEPSG fails in a VS2008 project

Helm, P.W. (Pim) van den pim.vandenhelm at tno.nl
Thu Dec 9 09:25:57 EST 2010


Hi all,

I have downloaded gdal-1.7.3 and build this via VS2008 succesfully. Furthermore I created an evironment variable GDAL_DATA that points to my location of the folder "gdal-1.7.3\data".

I copied the gdal17.dll towards my release location of my VS2008 application that will use this dll and added the gdal_i.lib and include files to my application aswell. The needed #includes are also in my project and know when the following code is called:

void CGeoLoc::ConvertDeltaToLatLon(int nr, double *x, double *y)
{
   double tx = m_geoX,
          ty = m_geoY;

   OGRSpatialReference out, in;
   OGRCoordinateTransformation *trans;
   OGRErr ogrErr;

   ogrErr = out.importFromEPSG(4326);

   double xref = m_geoX, yref = m_geoY;
   if (m_geoSystem != GS_MERCATOR)
   {
       ogrErr = in.importFromEPSG(3857);
       trans = OGRCreateCoordinateTransformation(&m_spatialRef, &in);

       if( trans == NULL || !trans->Transform(1, &xref, &yref))
          AfxMessageBox("Transform of point failed." );
   }

   for (int i=0; i < nr; i++)
   {
      x[i] += xref;
      y[i] += yref;
   }

   trans = OGRCreateCoordinateTransformation(&in, &out);
   if( trans == NULL || !trans->Transform(nr, x, y))
      AfxMessageBox("Transform of point failed." );
}

My code builds perfectly and also runs, so no issues there, but unfortunately the importFromEPSG fails in finding my geocoordinate systems and returns ogrErr = 6. What am I doing wrong? Or what do I need to add to get my application to work with gdal?

The code did work with the FWtools version (which I didn't like due to the large amount of used DLL's for functions I don't need. So I would really like to use the gdal build only.

Kind regards,
Pim
This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101209/eefaa17d/attachment.html


More information about the gdal-dev mailing list