#6885 closed defect (invalid)
Writing HF2 files does not work as expected.
Reported by: | homme | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | 2.1.3 |
Severity: | normal | Keywords: | HF2 |
Cc: |
Description
I would expect gdal_translate
to be able to convert GeoTiffs to HF2 format consistently. This is not the case however, as shown by the following commands and outputs based on the file input-ok.tif
(data files attached).
input-ok.tif
looks like this when opened in QGIS (v2.18.7):
After running the following command...
gdal_translate -of HF2 input-ok.tif output-bad.hf2
I would expect output-bad.hf2
to look like this when viewed in QGIS:
However, it looks as follows:
Interestingly, the following produces the expected output:
gdal_translate -of HF2 input-ok.tif output-ok.hf2 && \ gdalinfo -stats output-ok.hf2
The difference being that gdalinfo
creates the sidecar XML file.
Unfortunately, reducing input-ok.tif
by 1 pixel in size (to create input-bad.tif
) means that even running gdalinfo -stats
on the output HF2 file produces the unexpected output (output-bad.png
). This is the difference between running gdalinfo
on the good (old) and bad (new) output files:
-
.info
old new 1 1 Driver: HF2/HF2/HFZ heightfield raster 2 2 Files: output.hf2 3 Size is 90 8, 5513 Size is 907, 550 4 4 Coordinate System is: 5 5 PROJCS["WGS 84 / Pseudo-Mercator", 6 6 GEOGCS["WGS 84", … … 25 25 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"], 26 26 AUTHORITY["EPSG","3857"]] 27 27 Origin = (776826.722000000067055,5765238.115000000223517) 28 Pixel Size = (1.65 1542951541877,-1.652012704173526)28 Pixel Size = (1.653363836824723,-1.655016363635659) 29 29 Metadata: 30 30 VERTICAL_PRECISION=0.010000 31 31 Corner Coordinates: … … 35 35 Lower Right ( 778326.323, 5764327.856) ( 6d59'30.57"E, 45d53'59.76"N) 36 36 Center ( 777576.523, 5764782.986) ( 6d59' 6.32"E, 45d54'10.00"N) 37 37 Band 1 Block=256x1 Type=Float32, ColorInterp=Undefined 38 Minimum=0.000, Maximum=3323.809, Mean=235 2.065, StdDev=1137.78138 Minimum=0.000, Maximum=3323.809, Mean=2350.277, StdDev=1138.947 39 39 Unit Type: m 40 40 Metadata: 41 41 STATISTICS_MAXIMUM=3323.8090820312 42 STATISTICS_MEAN=235 2.065059935842 STATISTICS_MEAN=2350.276635773 43 43 STATISTICS_MINIMUM=1.1754943508223e-38 44 STATISTICS_STDDEV=113 7.780891463644 STATISTICS_STDDEV=1138.9468957056
Attachments (5)
Change History (8)
by , 7 years ago
Attachment: | input-ok.tif added |
---|
comment:1 by , 7 years ago
There is something in the histogram but you can't use a viewer like QGIS for evaluating 32bit imagery. Data must be scaled for viewing and when you say that input-bad never works it is just that QGIS does not automatically view it right. I converted your file as
gdal_translate -of HF2 input-bad.tif output-bad.hf2
QGIS shows output-bad.hf2 pretty well when I set the min-max values in range 2600-3200 from the image layer properties. What fools QGIS is probably the large number of cells in the first bucket coming from the large no-data area.
The HF2 driver manual does not speak anything about nodata http://www.gdal.org/frmt_hf2.html. It may be that the format does not support nodata at all. If this is the case this ticket is invalid.
comment:2 by , 7 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
Hi Jukka, thanks for looking into this - setting the appropriate range values for QGIS works for me too. I dug into the HF2 documentation further and it does indeed appear that the format has no support for NODATA
.
Input file that sometimes works.