Hi all, Thanks to Tamas Szekeres we are now using his binaries from http://www.gisinternals.com/sdk/ with MapWinGIS, our mapping ActiveX. This has drastically simplified our build process and we are very grateful for Tamas' help.
We're now struggling with some minor issues regarding our 'old' C++ code and the new binaries for GDAL, GEOS, Proj4, etc. Several of them I managed to solve, but I'm struggling with this one. We have code to read a prj file and get the Proj4 string: void ProjectionTools::GetProj4FromPRJFile(char * prjfileName, char ** prj4) { FILE * pFile; pFile = fopen (prjfileName,"r"); if (pFile == NULL) { // Doesn't exist return; } fclose(pFile); pFile = NULL; OGRSpatialReference* oSRS = new OGRSpatialReference(); char **papszPrj = CSLLoad(prjfileName); if (papszPrj == NULL) { return; } OGRErr eErr = oSRS->importFromESRI(papszPrj); if (eErr != OGRERR_NONE) { OGRErr eErr = oSRS->importFromProj4(*papszPrj); } CSLDestroy( papszPrj ); char * pszProj4 = NULL; eErr = oSRS->exportToProj4( &pszProj4 ); delete oSRS; <-- going wrong now *prj4 = new char[_tcslen(pszProj4)+1]; strcpy(*prj4, pszProj4); CPLFree(pszProj4); } This code was working for years, but now it crashes on delete oSRS;. I've been searching for examples of how to use exportToProj4() in C++ but can only find Python examples. And I'm not a C++ developer, just a C# developer :) How should I now free oSRS? Thanks for any advice. Paul *Paul Meems * Release manager, configuration manager and forum moderator of MapWindow GIS. www.mapwindow.org Owner of MapWindow.nl - Support for Dutch speaking users. www.mapwindow.nl
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev