Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5894 closed defect (fixed)

Germany Zone projections not properly stored by GTiff

Reported by: Mike Taves Owned by: warmerdam
Priority: low Milestone: 2.0.0
Component: default Version: 1.11.1
Severity: normal Keywords:
Cc:

Description

The GTiff driver does not properly store Germany Zones 1 to 5 projections, namely ESRI/EPSG codes 31491 to 31495. While the codes can be imported by OSR, and exported to PROJ.4 and WKT outputs, the data is lost when written to GeoTIFF.

from osgeo import osr, gdal
osr.UseExceptions()
gdal.UseExceptions()
drv = gdal.GetDriverByName('GTiff')
for code in [31491, 31492, 31493, 31494, 31495]:
    print('ESRI:' + str(code))
    fname = '/vsimem/tmp' + str(code)
    srs = osr.SpatialReference()
    srs.ImportFromEPSG(code)
    print('Input PROJ.4: ' + srs.ExportToProj4())
    ds = drv.Create(fname, 2, 3)
    ds.SetProjection(srs.ExportToWkt())
    ds = None
    ds = gdal.Open(fname)
    wkt_out = ds.GetProjection()
    ds = None
    gdal.Unlink(fname)
    srs_out = osr.SpatialReference()
    srs_out.ImportFromWkt(wkt_out)
    print('Output PROJ.4: ' + srs_out.ExportToProj4())

shows

ESRI:31491
Input PROJ.4: +proj=tmerc +lat_0=0 +lon_0=3 +k=1 +x_0=1500000 +y_0=0 +ellps=bessel +units=m +no_defs 
Output PROJ.4: 
ESRI:31492
Input PROJ.4: +proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +units=m +no_defs 
Output PROJ.4: 
ESRI:31493
Input PROJ.4: +proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +units=m +no_defs 
Output PROJ.4: 
ESRI:31494
Input PROJ.4: +proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel +units=m +no_defs 
Output PROJ.4: 
ESRI:31495
Input PROJ.4: +proj=tmerc +lat_0=0 +lon_0=15 +k=1 +x_0=5500000 +y_0=0 +ellps=bessel +units=m +no_defs 
Output PROJ.4: 

Note the none of these have an output PROJ.4, just an empty string. Further note that the first line of WKT is LOCAL_CS["Germany_Zone_1",, rather than PROJCS["Germany_Zone_1", from the input srs.

Change History (2)

comment:1 by Even Rouault, 9 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

Fixed by #5926 trunk r28920 "GTiff: use importFromEPSG() when ProjectedCSTypeGeoKey is available (#5926)"

trunk r28922 "tiff_srs.py: test EPSG:31491 (#5894)"

comment:2 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.