Opened 10 years ago

Closed 5 years ago

#5496 closed defect (wontfix)

gdal_translate does not preserve GEOLOCATION information

Reported by: etourigny Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: Utilities Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

When using gdal_translate tp convert a file with geolocation information, that information is not preserved in the output file.

I suspect other metadata may be ignored as well?

example using sstgeo.vrt from the autotest:

$ gdal_translate data/sstgeo.vrt tmp2.tif
Input file size is 60, 39
0...10...20...30...40...50...60...70...80...90...100 - done.
tourigny@supernova: /data/src/gdal/svn/trunk/autotest/gcore $ gdalinfo data/sstgeo.vrt 
Driver: VRT/Virtual Raster
Files: data/sstgeo.vrt
       /data/src/gdal/svn/trunk/autotest/gcore/data/sstgeo.tif
Size is 60, 39
Coordinate System is `'
Geolocation:
  LINE_OFFSET=0
  LINE_STEP=1
  PIXEL_OFFSET=0
  PIXEL_STEP=1
  SRS=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AXIS["Lat",NORTH],AXIS["Long",EAST],AUTHORITY["EPSG","4326"]]
  X_BAND=1
  X_DATASET=data/sstgeo.tif
  Y_BAND=2
  Y_DATASET=data/sstgeo.tif
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   39.0)
Upper Right (   60.0,    0.0)
Lower Right (   60.0,   39.0)
Center      (   30.0,   19.5)
Band 1 Block=60x39 Type=Int16, ColorInterp=Gray
  Min=-32767.000 Max=6244.000 
  Minimum=-32767.000, Maximum=6244.000, Mean=-19344.985, StdDev=17486.866
  NoData Value=-32767
  Metadata:
    STATISTICS_MAXIMUM=6244
    STATISTICS_MEAN=-19344.985470085
    STATISTICS_MINIMUM=-32767
    STATISTICS_STDDEV=17486.866320789
tourigny@supernova: /data/src/gdal/svn/trunk/autotest/gcore $ gdalinfo tmp2.tif 
Driver: GTiff/GeoTIFF
Files: tmp2.tif
Size is 60, 39
Coordinate System is `'
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   39.0)
Upper Right (   60.0,    0.0)
Lower Right (   60.0,   39.0)
Center      (   30.0,   19.5)
Band 1 Block=60x39 Type=Int16, ColorInterp=Gray
  Min=-32767.000 Max=6244.000 
  Minimum=-32767.000, Maximum=6244.000, Mean=-19344.985, StdDev=17486.866
  NoData Value=-32767
  Metadata:
    STATISTICS_MAXIMUM=6244
    STATISTICS_MEAN=-19344.985470085
    STATISTICS_MINIMUM=-32767
    STATISTICS_STDDEV=17486.866320789

in trunk the following test fails, perhaps it is too strict?

if( bSpatialArrangementPreserved )

Change History (3)

comment:1 by Even Rouault, 9 years ago

The bSpatialArrangementPreserved boolean is set to TRUE in that case, but the GTiff driver doesn't try to preserve the GEOLOCATION metadata domain. And it might actually be tricky to preserve it as GEOLOCATION points to other datasets with the X_DATASET/Y_DATASET items (often subdatasets of the source dataset), so replicating them might result in a somewhat broken GEOLOCATION...

comment:2 by Jukka Rahkonen, 9 years ago

If it is generally impossible to keep the GEOLOCATION metadata so that it remains correct, should we close this ticket as invalid? Or is the main issue in "I suspect other metadata may be ignored as well"? In that case the title and usage example should probably be edited.

comment:3 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: newclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.