Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#5893 closed defect (fixed)

Polyconic projections not properly stored by GTiff

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

Description

The GTiff driver does not properly store some Polyconic projections, namely EPSG codes 5472, 5530, 5880, 29100 and 29101. While the EPSG 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 [5472, 5530, 5880, 29100, 29101]:
    print('EPSG:' + str(code))
    fname = '/vsimem/tmp' + str(code)
    srs = osr.SpatialReference()
    try:
        srs.ImportFromEPSG(code)
    except RuntimeError as e:
        print(str(e).replace('\n', ' '))
        continue
    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

EPSG:5472
Input PROJ.4: +proj=poly +lat_0=8.25 +lon_0=-81 +x_0=914391.7962 +y_0=999404.7217154861 +ellps=clrk66 +to_meter=0.9143917962 +no_defs 
Output PROJ.4: 
EPSG:5530
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +towgs84=-67.35,3.88,-38.22,0,0,0,0 +units=m +no_defs 
Output PROJ.4: 
EPSG:5880
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
Output PROJ.4: 
EPSG:29100
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS67 +towgs84=-57,1,-41,0,0,0,0 +units=m +no_defs 
Output PROJ.4: 
EPSG:29101
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +towgs84=-57,1,-41,0,0,0,0 +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["SAD69 / Brazil Polyconic",, rather than PROJCS["SAD69 / Brazil Polyconic", from the input srs.

Change History (2)

comment:1 by Even Rouault, 9 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

Fixed in upstream libgeotiff / trunk internal libgeotiff.

EPSG:5472
Input PROJ.4: +proj=poly +lat_0=8.25 +lon_0=-81 +x_0=914391.7962 +y_0=999404.7217154861 +ellps=clrk66 +to_meter=0.9143917962 +no_defs 
Output PROJ.4: +proj=poly +lat_0=8.25 +lon_0=-81 +x_0=914391.7962 +y_0=999404.7217154861 +ellps=clrk66 +to_meter=0.9143917962 +no_defs 
EPSG:5530
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +towgs84=-67.35,3.88,-38.22,0,0,0,0 +units=m +no_defs 
Output PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +towgs84=-67.35,3.88,-38.22,0,0,0,0 +units=m +no_defs 
EPSG:5880
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
Output PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs 
EPSG:29100
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS67 +towgs84=-57,1,-41,0,0,0,0 +units=m +no_defs 
Output PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=GRS67 +towgs84=-57,1,-41,0,0,0,0 +units=m +no_defs 
EPSG:29101
Input PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +towgs84=-66.87,4.37,-38.52,0,0,0,0 +units=m +no_defs 
Output PROJ.4: +proj=poly +lat_0=0 +lon_0=-54 +x_0=5000000 +y_0=10000000 +ellps=aust_SA +towgs84=-66.87,4.37,-38.52,0,0,0,0 +units=m +no_defs 

comment:2 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.