Opened 11 years ago

Closed 5 years ago

#4892 closed defect (wontfix)

[PATCH] gdal_convert creates incorrect negative values when converting to ARG format.

Reported by: remanuele Owned by: dzwarg
Priority: normal Milestone: closed_because_of_github_migration
Component: default Version: svn-trunk
Severity: normal Keywords: gdal_translate ARG
Cc:

Description (last modified by remanuele)

reproduction:

In working directory, where ever attached dem file is located

$ gdal_translate -of ARG -ot Float32 mt_st_helens.dem mt_st_helens.arg

Actual Behavior:

$ gdalinfo -stats mt_st_helens.dem | grep Min

Minimum=676.000, ...

$ gdalinfo -stats mt_st_helens.arg | grep Min

Minimum=-32767.000, ...

Expected behavior: the Minimum for the .tiff and .arg files would be the same (676.0)

This same behavior happens if you were to convert the DEM to GeoTIFF, and then convert the GeoTIFF to ARG. The DEM and GeoTIFF formats both have a Minimum of 676.0, the ARG has -32767.0.

Attachments (2)

mt_st_helens.dem (972.0 KB ) - added by remanuele 11 years ago.
Mt. St. Helens DEM data from before the 1980 eruption.
nodata_support.patch (12.2 KB ) - added by dzwarg 11 years ago.
Addition of 'nodata' key to .json file keeps track of the NODATA value, especially when changing data types.

Download all attachments as: .zip

Change History (7)

by remanuele, 11 years ago

Attachment: mt_st_helens.dem added

Mt. St. Helens DEM data from before the 1980 eruption.

comment:1 by remanuele, 11 years ago

Description: modified (diff)

comment:2 by remanuele, 11 years ago

I'm getting this behavior with some other elevation model data (in GeoTiff format). This does seem to be a case where the NODATA value is being ignored. gdalinfo -stats provides the no data value, and the two values do not match up between the original and ARG files.

comment:3 by dzwarg, 11 years ago

Status: newassigned

The NODATA value for each data type supported by ARG is fixed to the following:

  • Int8: 128
  • Int16: -32767
  • Int32: -2e31
  • UInt8: 255
  • UInt16: 65535
  • UInt32: -2e31
  • Float32: NAN
  • Float64: NAN

When converting between rasters with different data types, these NODATA values are not translated, and the old NODATA value cannot be stored in the raster, nor it's metadata. The ARG specification must be updated to support custom NODATA values before they can be tracked during file format conversion.

by dzwarg, 11 years ago

Attachment: nodata_support.patch added

Addition of 'nodata' key to .json file keeps track of the NODATA value, especially when changing data types.

comment:4 by Jukka Rahkonen, 9 years ago

Summary: gdal_convert creates incorrect negative values when converting to ARG format.[PATCH] gdal_convert creates incorrect negative values when converting to ARG format.

You are commiter, dzwarg. Do you trust in your patch so much that you could apply it and close this ticket?

comment:5 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: assignedclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.