Skip to content

Discrepancies in COG metadata computed from "save_cog_with_dask" compared to GDAL's #209

@remi-braun

Description

@remi-braun

I have discrepancies in metadata between COGs saved with odc-geo and GDAL (via rioxarray), and I think this is maybe a bug in odc-geo:

  • missing LAYOUT=COG in Image Structure Metadata
  • discrepancy between the bands colorinterp: Band 1 is ColorInterp=Gray when the two other have ColorInterp=Undefined
  • INTERLEAVE=BAND instead of PIXEL (this is maybe it's a feature ?)

If this is all wanted, is there a way to change it to mimic GDAL's behaviour?


Computed with odcgeo 4.10.0:
gdalinfo cog_dask.tif

Size is 3700, 1536
Coordinate System is:
PROJCRS["WGS 84 / Pseudo-Mercator",
    BASEGEOGCRS["WGS 84",
        ENSEMBLE["World Geodetic System 1984 ensemble",
            MEMBER["World Geodetic System 1984 (Transit)"],
            MEMBER["World Geodetic System 1984 (G730)"],
            MEMBER["World Geodetic System 1984 (G873)"],
            MEMBER["World Geodetic System 1984 (G1150)"],
            MEMBER["World Geodetic System 1984 (G1674)"],
            MEMBER["World Geodetic System 1984 (G1762)"],
            MEMBER["World Geodetic System 1984 (G2139)"],
            MEMBER["World Geodetic System 1984 (G2296)"],
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]],
            ENSEMBLEACCURACY[2.0]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4326]],
    CONVERSION["Popular Visualisation Pseudo-Mercator",
        METHOD["Popular Visualisation Pseudo Mercator",
            ID["EPSG",1024]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting (X)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing (Y)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["Web mapping and visualisation."],
        AREA["World between 85.06┬░S and 85.06┬░N."],
        BBOX[-85.06,-180,85.06,180]],
    ID["EPSG",3857]]
Data axis to CRS axis mapping: 1,2
Origin = (6166949.000000000000000,-2382654.500000000000000)
Pixel Size = (0.500000000000000,-0.500000000000000)
Metadata:
  TIFFTAG_XRESOLUTION=1
  TIFFTAG_YRESOLUTION=1
  TIFFTAG_RESOLUTIONUNIT=1 (unitless)
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=DEFLATE
  INTERLEAVE=BAND
  PREDICTOR=2
Corner Coordinates:
Upper Left  ( 6166949.000,-2382654.500) ( 55d23'55.12"E, 20d55'21.44"S)
Lower Left  ( 6166949.000,-2383422.500) ( 55d23'55.12"E, 20d55'44.64"S)
Upper Right ( 6168799.000,-2382654.500) ( 55d24'54.95"E, 20d55'21.44"S)
Lower Right ( 6168799.000,-2383422.500) ( 55d24'54.95"E, 20d55'44.64"S)
Center      ( 6167874.000,-2383038.500) ( 55d24'25.04"E, 20d55'33.04"S)
Band 1 Block=2048x1456 Type=Byte, ColorInterp=Gray
  Description = RED
  NoData Value=0
  Overviews: 1850x768, 925x384
Band 2 Block=2048x1456 Type=Byte, ColorInterp=Undefined
  Description = GREEN
  NoData Value=0
  Overviews: 1850x768, 925x384
Band 3 Block=2048x1456 Type=Byte, ColorInterp=Undefined
  Description = BLUE
  NoData Value=0
  Overviews: 1850x768, 925x384

gdalinfo cog_rioxarray.tif

Size is 3700, 1535
Coordinate System is:
PROJCRS["WGS 84 / Pseudo-Mercator",
    BASEGEOGCRS["WGS 84",
        ENSEMBLE["World Geodetic System 1984 ensemble",
            MEMBER["World Geodetic System 1984 (Transit)"],
            MEMBER["World Geodetic System 1984 (G730)"],
            MEMBER["World Geodetic System 1984 (G873)"],
            MEMBER["World Geodetic System 1984 (G1150)"],
            MEMBER["World Geodetic System 1984 (G1674)"],
            MEMBER["World Geodetic System 1984 (G1762)"],
            MEMBER["World Geodetic System 1984 (G2139)"],
            MEMBER["World Geodetic System 1984 (G2296)"],
            ELLIPSOID["WGS 84",6378137,298.257223563,
                LENGTHUNIT["metre",1]],
            ENSEMBLEACCURACY[2.0]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433]],
        ID["EPSG",4326]],
    CONVERSION["Popular Visualisation Pseudo-Mercator",
        METHOD["Popular Visualisation Pseudo Mercator",
            ID["EPSG",1024]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["False easting",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting (X)",east,
            ORDER[1],
            LENGTHUNIT["metre",1]],
        AXIS["northing (Y)",north,
            ORDER[2],
            LENGTHUNIT["metre",1]],
    USAGE[
        SCOPE["Web mapping and visualisation."],
        AREA["World between 85.06┬░S and 85.06┬░N."],
        BBOX[-85.06,-180,85.06,180]],
    ID["EPSG",3857]]
Data axis to CRS axis mapping: 1,2
Origin = (6166949.000000000000000,-2382654.500000000000000)
Pixel Size = (0.500000000000000,-0.500000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  LAYOUT=COG
  COMPRESSION=DEFLATE
  INTERLEAVE=PIXEL
  PREDICTOR=2
Corner Coordinates:
Upper Left  ( 6166949.000,-2382654.500) ( 55d23'55.12"E, 20d55'21.44"S)
Lower Left  ( 6166949.000,-2383422.000) ( 55d23'55.12"E, 20d55'44.62"S)
Upper Right ( 6168799.000,-2382654.500) ( 55d24'54.95"E, 20d55'21.44"S)
Lower Right ( 6168799.000,-2383422.000) ( 55d24'54.95"E, 20d55'44.62"S)
Center      ( 6167874.000,-2383038.250) ( 55d24'25.04"E, 20d55'33.03"S)
Band 1 Block=512x512 Type=Byte, ColorInterp=Undefined
  Description = RED
  NoData Value=0
  Overviews: 1850x767, 925x383, 462x191
Band 2 Block=512x512 Type=Byte, ColorInterp=Undefined
  Description = GREEN
  NoData Value=0
  Overviews: 1850x767, 925x383, 462x191
Band 3 Block=512x512 Type=Byte, ColorInterp=Undefined
  Description = BLUE
  NoData Value=0
  Overviews: 1850x767, 925x383, 462x191

Here are the files: cogs.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions