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 <[email protected]> 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
[email protected]
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
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to