Opened 7 years ago

Closed 7 years ago

#7010 closed defect (invalid)

Vertical datum is dropped when writing tif file

Reported by: aghariani Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

When setting a projection with a vertical datum the operation is never committed to the file itself. The projection has the vertical information once I set the projection but if I close the file and reopen it, it's not there anymore. Doing a gdalinfo on the file also show the vertical datum has been dropped.

I am getting the same issue with gdalwarp: (gdalwarp -t_srs EPSG:32636+3855 input.tif output.tif)

While the values are changed properly to reflect the addition of the geoid EGM2008, the resulting file does not have the vertical datum info when doing a gdalinfo for example.

Example in c++:

GDALAllRegister(); GDALDataset* dataset = (GDALDataset*)GDALOpen("D:
test.tif", GA_Update);

const char* projin = dataset->GetProjectionRef();

const char* proj = "COMPD_CS[\"WGS 84 / UTM zone 36N + EGM2008 geoid height\",PROJCS[\"WGS 84 / UTM zone 36N\",GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]],PROJECTION[\"Transverse_Mercator\"],PARAMETER[\"latitude_of_origin\",0],PARAMETER[\"central_meridian\",33],PARAMETER[\"scale_factor\",0.9996],PARAMETER[\"false_easting\",500000],PARAMETER[\"false_northing\",0],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Easting\",EAST],AXIS[\"Northing\",NORTH],AUTHORITY[\"EPSG\",\"32636\"]],VERT_CS[\"EGM2008 geoid height\",VERT_DATUM[\"EGM2008 geoid\",2005,EXTENSION[\"PROJ4_GRIDS\",\"egm08_25.gtx\"],AUTHORITY[\"EPSG\",\"1027\"]],UNIT[\"metre\",1,AUTHORITY[\"EPSG\",\"9001\"]],AXIS[\"Up\",UP],AUTHORITY[\"EPSG\",\"3855\"]]]";

CPLErr error = dataset->SetProjection(proj);

const char* projin2 = dataset->GetProjectionRef();

GDALClose(dataset);

Change History (2)

comment:1 by Even Rouault, 7 years ago

In 39895:

GTiff doc: improve doc of GTIFF_REPORT_COMPD_CS (refs #7010)

comment:2 by Even Rouault, 7 years ago

Resolution: invalid
Status: newclosed

By default, on read, the vertical component is stripped, for compatibility reasons for most cases where it is not used. You can alter this behaviour by setting the GTIFF_REPORT_COMPD_CS configuration option / environment variable to YES.

See http://gdal.org/frmt_gtiff.html """ GTIFF_REPORT_COMPD_CS: (GDAL >= 1.9.0). Can be set to TRUE to avoid stripping the vertical CS of compound CS. Default value : FALSE """

Note: See TracTickets for help on using tickets.