[gdal-dev] Projection description class

Frank Warmerdam warmerdam at p...
Fri Jul 13 08:38:52 EDT 2001


Ben Discoe wrote:
> 1. Is there a good reason why there is no OGRSpatialReference::GetDatum()?
> I suppose datum could be parsed out of the text returned by one of the
> "exportTo" methods.

Ben,

There is no good reason, but the intention is that simple values from the
tree, such as DATUM, can be fetched with OGRSpatialReference::GetNodeValue().

eg. 

pszDatum = oSRS.GetNodeValue("DATUM");

More specific get methods have been implemented for complex values, or
values which we want to support specific defaulting rules for. 

> 2. The datum can be set as one of the arguments to SetGeogCS(), but how
> would i set the datum if specifying some other projection, such as UTM?

You would first set the projection information (ie. SetUTM()) and then you
would do the SetGeogCS() call to set the related geographic coordinate
system information. Don't do the SetGeogCS() first, or the coordinate
system as a whole will be geographic.

I am happy to tweak the behaviour of OGRSpatialReference when you run into
things that are likely to be widespread impediments to it's use. 

> 3. Must the projection be fully initialized before it can be queried? I
> tried the following:
> OGRSpatialReference test;
> int zone = test.GetUTMZone();
> which results not in an error message, but a crash.

This is a bug. I have committed a fix for it to ogrspatialreference.cpp. Note
that GetUTMZone() returns zero if it fails for some reason, such as it not
really being a UTM projection. 

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