4

I have DEMs with "-3.40282e+38" values that are supposed to be the NoData values. However, if the rasters are loaded into QGIS (3.4.11), the value can not get assigned with "add additional no data value" via the transparency tab.

When this value is assigned with gdal_translate -a_nodata -3.40282e+38 input.tif output.tif the output.tif shows this value as NoData but QGIS still does not recognize it. However, if the NoData value is computed in the tif properties in ArcCatalog and then exportet as a new tif, the assigned NoData value of the exported tif is recognized in QGIS.

How can I assign such large float values as NoData in QGIS (or GDAL)?

I am using QGIS 3.4.11 LTR on a Linux Mint 19.2 operating system. Edit: GDAL version 2.2.3 is used

3

According to this site, the value of -3.40282e38 is 0xff7fffee, which is a 'quiet' NaN ("Not a number") value according to this page .

NaN is a sensible way to represent NODATA. Certain ranges of binary values for floats are used to represent NaN, infinity, minus infinity and so on.

This nodata value suggests the original is single precision floating point (e.g. float32)

It could be that

  • your current GDAL or QGIS doesn't recognise this bit pattern as a NaN
  • saving it in ArcGIS converts it to a NaN that QGIS does understand
  • it might be that GDAL is defaulting to 64 bit output?

It might help if you can edit your question to include the GDAL version (you should be able to get this from QGIS, using QGIS > About QGIS

I would maybe try setting the output type in gdal_translate to float32, e.g. using the -ot Float32 option to see if that works.

  • Thank you for the suggestions. GDAL version 2.2.3 is used. However, -ot Float32 did not work in my case. But I found a solution to my problem and posted it as an answer. – youlion Oct 10 at 16:09
0

I found a solution for my case:

I was using the given "minimum" value -3.40282e+38 from the Layers overview in QGIS.

However, using "Raster layer statistics" from the Processing Toolbox in QGIS (3.4.12), is showing more fractional digits: 'MIN': -3.4028234663852886e+38

Using this number to "add additional no data value" via the transparency tab in QGIS works in my case!

Also, using this number in my original command, does the job: gdal_translate -a_nodata -3.4028234663852886e+38 input.tif output.tif. The output.tif gets the nodata value automatically assigned when loaded into QGIS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.