Re: [gdal-dev] importFromEPSG fails in a VS2008 project

Ivan Lucena ivan.lucena at pmldnet.com
Thu Dec 9 09:35:35 EST 2010


Helm,

Have you used the Microsoft Process Monitor. That could help.

Ivan

>  -------Original Message-------
>  From: Helm, P.W. (Pim) van den <pim.vandenhelm at tno.nl>
>  To: gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
>  Subject: [gdal-dev] importFromEPSG fails in a VS2008 project
>  Sent: Dec 09 '10 09:25
>  
>  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
>  --------------------
>  _______________________________________________
>  gdal-dev mailing list
>  [LINK: compose.php?to=gdal-dev at lists.osgeo.org] gdal-dev at lists.osgeo.org
>  [LINK: http://lists.osgeo.org/mailman/listinfo/gdal-dev]
>  http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list