[Gdal-dev] OGR Spatial Questions

Peter von Gaza pvg at pixelmapper.com
Mon Jan 17 04:15:24 EST 2005


Hi Frank,
I've just begun my long intended projected of replacing ("gutting") my 
attempts at projection support with your OGR. What I've done is compile 
a small DLL with the core ORG spatial routines. I'm testing by reading 
Geotiffs (UTM and Albers) and trying to get Lat/Long screen coordinates. 
Running into some trouble. First I tested with some of your examples:

     OGRSpatialReference    oUTM, *poLatLong;
     OGRCoordinateTransformation *poTransform;

     oUTM.SetProjCS("UTM 17 / WGS84");
     oUTM.SetWellKnownGeogCS( "WGS84" );
     oUTM.SetUTM( 17 );

     poLatLong = oUTM.CloneGeogCS();
     poTransform = OGRCreateCoordinateTransformation( &oUTM, poLatLong );

Works fine. Then I load a geotiff and try the following:

     char *pszProjection = GTIFGetOGISDefn(gtif, &defn );
     // string looks like it should

     OGRSpatialReference oSRS;
     OGRErr i = oSRS.SetProjection( pszProjection );

To this point seem ok.

     OGRSpatialReference    *poLatLong2;
     poLatLong2 = oSRS.CloneGeogCS();

NADA, return NULL. Am I missing a key step in setting up projections 
form geotiffs? Could this be related to proj.dll (I using the 
precompiled binary from the proj4 site)? Before I start digging I'm 
hoping there is an easy solution.

This is my first go at your code and using the proj4 dll.

Thanks,
Peter




More information about the Gdal-dev mailing list