Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6949 closed defect (fixed)

gdal_translate fails to convert HFZ

Reported by: homme Owned by: warmerdam
Priority: normal Milestone: 2.1.5
Component: default Version: 2.2.0
Severity: normal Keywords:
Cc:

Description (last modified by homme)

I have the following compressed Heightfield raster that was originally generated by gdal_translate (see attached test.hfz file):

$ gdalinfo -stats test.hfz
Driver: HF2/HF2/HFZ heightfield raster
Files: test.hfz
Size is 257, 257
Coordinate System is:
PROJCS["WGS 84 / Pseudo-Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0,
            AUTHORITY["EPSG","8901"]],
        UNIT["degree",0.0174532925199433,
            AUTHORITY["EPSG","9122"]],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AXIS["X",EAST],
    AXIS["Y",NORTH],
    EXTENSION["PROJ4","+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs"],
    AUTHORITY["EPSG","3857"]]
Origin = (777823.199999999953434,5845904.000000000000000)
Pixel Size = (19.034903000000185,-19.034903000000185)
Metadata:
  VERTICAL_PRECISION=1.000000
Corner Coordinates:
Upper Left  (  777823.200, 5845904.000) (  6d59'14.30"E, 46d24'27.23"N)
Lower Left  (  777823.200, 5841012.030) (  6d59'14.30"E, 46d22'38.12"N)
Upper Right (  782715.170, 5845904.000) (  7d 1'52.50"E, 46d24'27.23"N)
Lower Right (  782715.170, 5841012.030) (  7d 1'52.50"E, 46d22'38.12"N)
Center      (  780269.185, 5843458.015) (  7d 0'33.40"E, 46d23'32.68"N)
Band 1 Block=256x1 Type=Float32, ColorInterp=Undefined
ERROR 3: File too short
ERROR 1: test.hfz, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 3: File too short
ERROR 1: test.hfz, band 1: IReadBlock failed at X offset 0, Y offset 1
  Minimum=0.000, Maximum=2184.915, Mean=1662.401, StdDev=227.929
  Unit Type: m
  Metadata:
    STATISTICS_MAXIMUM=2184.9145507812
    STATISTICS_MEAN=1662.4009253152
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=227.9285753811

As you can see gdalinfo outputs errors, but still exits successfully with status 0. Running the same file through gdal_translate does fail with exit status 1, however:

$ gdal_translate -of GTiff test.hfz test.tiff
Input file size is 257, 257
0ERROR 3: File too short
ERROR 1: test.hfz, band 1: IReadBlock failed at X offset 0, Y offset 0
ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0

test.hfz appears to be valid and can be displayed correctly by the official L3DT client, as well as QGIS: Screenshot of `test.hfz` opened in L3DT client.

Attachments (2)

test.hfz (29.0 KB ) - added by homme 7 years ago.
HFZ Heightfield raster
l3dt.png (56.5 KB ) - added by homme 7 years ago.
Screenshot of test.hfz opened in L3DT client.

Download all attachments as: .zip

Change History (8)

by homme, 7 years ago

Attachment: test.hfz added

HFZ Heightfield raster

by homme, 7 years ago

Attachment: l3dt.png added

Screenshot of test.hfz opened in L3DT client.

comment:1 by homme, 7 years ago

Description: modified (diff)

comment:2 by Even Rouault, 7 years ago

Resolution: fixed
Status: newclosed

In 39383:

HF2: fix reading tiles that are 1-pixel wide (2.1 regression, fixes #6949)

comment:3 by Even Rouault, 7 years ago

In 39384:

HF2: fix reading tiles that are 1-pixel wide (2.1 regression, fixes #6949)

comment:4 by Even Rouault, 7 years ago

In 39385:

HF2: fix reading tiles that are 1-pixel wide (2.1 regression, fixes #6949)

comment:5 by homme, 7 years ago

Thanks Even, that's great!

comment:6 by Even Rouault, 7 years ago

Milestone: 2.1.5
Note: See TracTickets for help on using tickets.