[gdal-dev] GTiff driver changes datum and spheroid names during creation in 1.5.2

Steve Gaffigan gaffigan at sfos.uaf.edu
Thu Sep 25 14:54:00 EDT 2008


Below is some python code and output which demonstrates a problem I'm 
having when writing GTiff's under gdal-1.5.2, wherein the DATUM and 
SPHEROID names are changed from what's in the source srs, 
"Not_specified_based_on_Authalic_Sphere" and "Sphere", to "unknown" and 
"unnamed", respectively.

While this is not a problem in Mapserver, it is in ArcGIS, because it 
causes a failure to associate GCS_SPHERE with spatial reference and the 
result is a significant shift when viewing the layer.

#### begin program
try:  from osgeo import gdal
except:  import gdal

src_ds = 
print src_ds.GetProjectionRef()
print 'Coordinate system from source\n    %s' % src_ds.GetProjectionRef()
driver = gdal.GetDriverByName('GTiff')
dst_ds = driver.CreateCopy('A20080916_232000_sst.tif', src_ds, 1, 
print 'Coordinate system from GTiff through CreateCopy()\n    %s' % 
del dst_ds
#### end program

#### begin output
Coordinate system from source
Coordinate system from GTiff through CreateCopy()
#### end output

Under gdal-1.4.2, the names are not changed.  If I use 1.5.2 gdal to 
open the geotif created with 1.4.2 gdal, which has the unchanged names, 
then the SPHEROID name shows as "unretrievable - using WGS84", as below. 
  Regardless of gdal version, if I create files using the HDF4Image or 
netCDF drivers, instead of GTiff, then the names are not changed.

# Coordinate system of GTiff created by gdal-1.4.2 as shown in gdal-1.5.2
GEOGCS["GCS_Sphere",DATUM["unknown",SPHEROID["unretrievable - using 

It seems to me that there is a bug in the GTiff driver, introduced in 
1.5.  Am I wrong?

Thanks in advance.


More information about the gdal-dev mailing list