[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
Hello,
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 =
gdal.Open('http://ak.aoos.org/opendap/testing/modis/A20080916_232000_sst.hdf?l3m_data[y][x]')
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,
['COMPRESS=LZW'])
print 'Coordinate system from GTiff through CreateCopy()\n %s' %
dst_ds.GetProjectionRef()
del dst_ds
#### end program
#### begin output
Coordinate system from source
GEOGCS["GCS_Sphere",DATUM["Not_specified_based_on_Authalic_Sphere",SPHEROID["Sphere",6371000,0]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Coordinate system from GTiff through CreateCopy()
GEOGCS["GCS_Sphere",DATUM["unknown",SPHEROID["unnamed",6371000,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
#### 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
WGS84",6378137,298.257223563,AUTHORITY["EPSG","0"]],AUTHORITY["EPSG","6035"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
It seems to me that there is a bug in the GTiff driver, introduced in
1.5. Am I wrong?
Thanks in advance.
Steve
More information about the gdal-dev
mailing list