You can have a look at the code used by the gdalsrsinfo , which basically opens a GDAL/OGR datasource and outputs the proj4 (or wkt) string.
Assuming you use c/c++ of course... http://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalsrsinfo.cpp Here is the relevant code (some declarations missing) poGDALDS = (GDALDataset *) GDALOpen( pszInput, GA_ReadOnly ); if ( poGDALDS != NULL && poGDALDS->GetProjectionRef( ) != NULL ) { pszProjection = (char *) poGDALDS->GetProjectionRef( ); if( oSRS.importFromWkt( &pszProjection ) == CE_None ) { CPLDebug( "gdalsrsinfo", "got SRS from GDAL" ); bGotSRS = TRUE; } GDALClose( (GDALDatasetH) poGDALDS ); if ( ! bGotSRS ) CPLDebug( "gdalsrsinfo", "did not open with GDAL" ); } oSRS.exportToProj4( &pszOutput ); printf( "\'%s\'\n", pszOutput ); On Wed, Apr 17, 2013 at 8:23 AM, wsvries <wsvr...@xs4all.nl> wrote: > Hi, > I am working on an application (adding terrain info to maps for 3D > rendering) that does some heavy projection calculations using the proj4 > libs. > Input for now is geotiff. > I have Googled a lot, but I was not able to find any libs that can output > proj4 strings based on geotiff input. > I have seen (GDAL based) utilities that are able to do that but no libs to > use in my application. > Any hint is welcome. > Thanks. > ______________________________**_________________ > gdal-dev mailing list > gdal-dev@lists.osgeo.org > http://lists.osgeo.org/**mailman/listinfo/gdal-dev<http://lists.osgeo.org/mailman/listinfo/gdal-dev> >
_______________________________________________ gdal-dev mailing list gdal-dev@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/gdal-dev