[gdal-dev] lib to get from GDAL/geotiff to PROJ4

wsvries wsvries at xs4all.nl
Wed Apr 17 06:44:11 PDT 2013


Thanks.
I took the code you mentioned, installed the gdal libdev and run G++ on 
it and voila!


Etienne Tourigny schreef op 2013-04-17 13:48:
> 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 [2]
> 
> 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 <wsvries at 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 at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev [1]
> 
> 
> 
> Links:
> ------
> [1] http://lists.osgeo.org/mailman/listinfo/gdal-dev
> [2] http://trac.osgeo.org/gdal/browser/trunk/gdal/apps/gdalsrsinfo.cpp


More information about the gdal-dev mailing list