2

I have merged several TIFF files into a bigger one. When trying to add this image to QGIS I get the following error:

Cannot open TIFF file due to missing codec. Raster layer Provider is not valid (provider: gdal, URI: /data/orto/Processed/tifs/L4.tif

This merged TIFF is created by creating a virtual raster of smaller images and translating that using the following command:

gdal_translate -co TILED=YES -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR L4.vrt L4.tif

After the translate, I added overviews using the following command:

gdaladdo -ro --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW YCBCR  L4.tif 2 4 8 16 32 64 128 256

gdalinfo commands gives me the following information:

Driver: GTiff/GeoTIFF
Files: L4.tif
    L4.tif.ovr
Size is 96000, 96000
Coordinate System is:
PROJCS["WGS 84 / UTM zone 35N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",27],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32635"]]
Origin = (476000.000000000000000,6762000.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
COMPRESSION=YCbCr JPEG
INTERLEAVE=PIXEL
SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (  476000.000, 6762000.000) ( 26d33'22.92"E, 60d59'31.93"N)
Lower Left  (  476000.000, 6738000.000) ( 26d33'33.65"E, 60d46'36.24"N)
Upper Right (  500000.000, 6762000.000) ( 27d 0' 0.00"E, 60d59'34.55"N)
Lower Right (  500000.000, 6738000.000) ( 27d 0' 0.00"E, 60d46'38.85"N)
Center      (  488000.000, 6750000.000) ( 26d46'44.14"E, 60d53' 6.05"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
Overviews: 48000x48000, 24000x24000, 12000x12000, 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
Overviews: 48000x48000, 24000x24000, 12000x12000, 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
Overviews: 48000x48000, 24000x24000, 12000x12000, 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375

Some information is lost, and some is changed during the translate command. When I run gdalinfo on one of the original images I get:

Driver: GTiff/GeoTIFF
Files: ../../L4443A1.tif
       ../../L4443A1.tif.ovr
Size is 12000, 12000
Coordinate System is:
PROJCS["WGS_1984_UTM_Zone_35N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",27],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","32635"]]
Origin = (476000.000000000000000,6741000.000000000000000)
Pixel Size = (0.250000000000000,-0.250000000000000)
Metadata:
  AREA_OR_POINT=Area
  DataType=Generic
Image Structure Metadata:
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  SOURCE_COLOR_SPACE=YCbCr
Corner Coordinates:
Upper Left  (  476000.000, 6741000.000) ( 26d33'32.32"E, 60d48'13.21"N)
Lower Left  (  476000.000, 6738000.000) ( 26d33'33.65"E, 60d46'36.24"N)
Upper Right (  479000.000, 6741000.000) ( 26d36'50.77"E, 60d48'13.82"N)
Lower Right (  479000.000, 6738000.000) ( 26d36'51.94"E, 60d46'36.85"N)
Center      (  477500.000, 6739500.000) ( 26d35'12.17"E, 60d47'25.04"N)
Band 1 Block=128x128 Type=Byte, ColorInterp=Red
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
  Metadata:
    RepresentationType=ATHEMATIC
Band 2 Block=128x128 Type=Byte, ColorInterp=Green
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
  Metadata:
    RepresentationType=ATHEMATIC
Band 3 Block=128x128 Type=Byte, ColorInterp=Blue
  Overviews: 6000x6000, 3000x3000, 1500x1500, 750x750, 375x375, 188x188
  Metadata:
    RepresentationType=ATHEMATIC

So CRS seems to change a little, and metadata on bands is lost.

Any ideas why QGIS cannot open this file? Is the changed CRS the problem?

Update: Okay I installed older version of QGIS (I'm using CentSO 7 so that would be 2.14), and I managed to open the image. The QGIS I was using is 3.9 from Flathub, and it seems there is something wrong with it.

  • Missing codec probably refers to jpeg codec but that should be included with your QGIS. Make a test with -co COMPRESS=deflate to be sure. – user30184 Nov 4 at 10:30
  • How large is the resulting TIFF? Does it exceed 4GB? – Vince Nov 4 at 11:05
  • The resulting TIFF is about 1.5Gb. Seems like there actually is missing codec. QGIS was able to open the image without jpeg compression. I also couldn't open any of the original images. However I don't undestand how I could be missing jpeg codec – jfp Nov 4 at 11:17