[gdal-dev] OGRSpatialReference Datum behavior

Frank Warmerdam warmerdam at p...
Sun Jul 15 23:27:32 EDT 2001


Ben Discoe wrote:
> 
> Sorry about the rash of feedback, but it's been an exciting day of porting
> to OGR.
> 
> I'm experiencing an odd behavior:
> 
> OGRSpatialReference sr;
> sr.SetWellKnownGeogCS( "NAD27" );
> sr.SetUTM( 10, TRUE );
> const char *datum = sr.GetAttrValue("DATUM");
> 
> This returns not "North_American_Datum_1927" as expected, but NULL. It is
> correct if i don't call SetUTM. Somehow the call to SetUTM is wiping out
> the datum. Bug?

Ben,

The theory was that you should set the projection and then make calls
to set the GEOGCS which would result in it being added to the definition.
However, these expectation are based on viewing things in terms of creating
the WKT parse tree, and don't really abstract the management of the 
SRS as much as I would like. I have modified SetUTM() and a bunch of related
functions for setting projections to demote the GEOGCS node to being a
child of the OGRSpatialReference instead of just blowing it away when things
are done in this order. Your problem should be resolved. 

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at p...
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list