[OSRS-PROJ] OGC WKT

Frank Warmerdam warmerdam at pobox.com
Thu Oct 4 13:16:38 PDT 2001


Paul Ramsey wrote:
> 
> > Let me know if you need details.
> 
> One quick-and-easy detail you could give is a snippet which instantiates
> the OGR object with a WKT string and then writes out the proj4 string...
> 
> Thanks,
> Paul

Paul, 

Here is a tiny program doing this in C++.  that's what you wanted,
right?

#include "ogr_spatialref.h"

int main()

{
    OGRSpatialReference      oSRS;
    char                     *pszProj4 = NULL;
    char                     *pszWKT = "GEOGCS[\"WGS
84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS
84\",6378137,298.257223563,AUTHORITY[\"EPSG\",7030]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY[\"EPSG\",6326]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",8901]],UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",9108]],AXIS[\"Lat\",NORTH],AXIS[\"Long\",EAST],AUTHORITY[\"EPSG\",4326]]";

    oSRS.importFromWkt( &pszWKT );

    oSRS.exportToProj4( &pszProj4 );

    printf( "proj.4 = %s\n", pszProj4 );
}

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent
----------------------------------------
PROJ.4 Discussion List
See http://www.remotesensing.org/proj for subscription, unsubscription
and other information.



More information about the Proj mailing list