tiffhax icon indicating copy to clipboard operation
tiffhax copied to clipboard

magic number was 43 expected 42

Open AsgerPetersen opened this issue 4 years ago • 4 comments

First: Thank you for a very useful tool.

I have encountered a geotiff file where the magic number apparently is 43 instead of 42 which makes tiffhax refuse to parse it at all. GDAL reads the file without complaining, so I guess it must be some sort of accepted value.

tiffhax

❯ ./tiffhax ~/Data/Vandløbsoversvømmelser/Rudersdal/Rudersdal_Vandl›b20.tif
2020/06/17 10:53:59 Could not parse: could not parse header, not a tiff file, magic number was 43 expected 42

gdalinfo output of the same file

❯ gdalinfo ~/Data/Vandløbsoversvømmelser/Rudersdal/Rudersdal_Vandl›b20.tif
Driver: GTiff/GeoTIFF
Files: /Users/asger/Data/Vandløbsoversvømmelser/Rudersdal/Rudersdal_Vandl›b20.tif
Size is 30125, 23480
Coordinate System is:
PROJCRS["ETRS_1989_UTM_Zone_32N",
    BASEGEOGCRS["GCS_ETRS_1989",
        DATUM["ETRS_1989",
            ELLIPSOID["GRS_1980",6378137,298.257222101,
                LENGTHUNIT["metre",1,
                    ID["EPSG",9001]]]],
        PRIMEM["Greenwich",0,
            ANGLEUNIT["degree",0.0174532925199433,
                ID["EPSG",9122]]]],
    CONVERSION["Transverse Mercator",
        METHOD["Transverse Mercator",
            ID["EPSG",9807]],
        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",9,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
        PARAMETER["Scale factor at natural origin",0.9996,
            SCALEUNIT["unity",1],
            ID["EPSG",8805]],
        PARAMETER["False easting",500000,
            LENGTHUNIT["metre",1],
            ID["EPSG",8806]],
        PARAMETER["False northing",0,
            LENGTHUNIT["metre",1],
            ID["EPSG",8807]]],
    CS[Cartesian,2],
        AXIS["easting",east,
            ORDER[1],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]],
        AXIS["northing",north,
            ORDER[2],
            LENGTHUNIT["metre",1,
                ID["EPSG",9001]]]]
Data axis to CRS axis mapping: 1,2
Origin = (712430.400000000023283,6197954.399999999441206)
Pixel Size = (0.400000000000000,-0.400000000000000)
Metadata:
  AREA_OR_POINT=Area
  DataType=Generic
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  712430.400, 6197954.400) ( 12d23'46.77"E, 55d52'48.50"N)
Lower Left  (  712430.400, 6188562.400) ( 12d23'20.34"E, 55d47'45.23"N)
Upper Right (  724480.400, 6197954.400) ( 12d35'18.84"E, 55d52'28.85"N)
Lower Right (  724480.400, 6188562.400) ( 12d34'50.92"E, 55d47'25.64"N)
Center      (  718455.400, 6193258.400) ( 12d29'19.23"E, 55d50' 7.19"N)
Band 1 Block=128x128 Type=Float32, ColorInterp=Gray
  NoData Value=-3.4028234663852886e+38
  Metadata:
    RepresentationType=ATHEMATIC

The file can be downloaded (approx 150MB zip) via this link https://sit-ftp.statens-it.dk/main.html?download&weblink=1dc2807cedc07db3433d545807d7d239&realfilename=Rudersdal.zip from this page https://oversvommelse.kyst.dk/planperiode-2016-2021/plantrin-1/vandloebsoversvoemmelser/

AsgerPetersen avatar Jun 17 '20 09:06 AsgerPetersen

Hi @AsgerPetersen 43 is the magic number for a bigtiff file.

I'm currently working on refactoring things to make this handle bigtiff files, but its been on the back burner for a while.

emilyselwood avatar Jun 17 '20 09:06 emilyselwood

I'm going to leave this open for now until I get the code for the big tiff change sorted out

emilyselwood avatar Jun 17 '20 09:06 emilyselwood

Hi @emilyselwood

I have taken the liberty of suggesting a small change to hold the hand of unknowing users like myself.

Thanks again!

AsgerPetersen avatar Jun 17 '20 09:06 AsgerPetersen

Thank you @AsgerPetersen I've merged your request. I'm still going to leave this open as its probably a good thing to have better tracking of the issue than my head

emilyselwood avatar Jun 17 '20 11:06 emilyselwood