Opened 9 years ago

Closed 9 years ago

#6060 closed enhancement (fixed)

AAIGrid: writing float types should ensure that a decimal is in the first pixel

Reported by: Mike Taves Owned by: warmerdam
Priority: normal Milestone: 2.0.1
Component: default Version: svn-trunk
Severity: normal Keywords: aaigrid
Cc:

Description (last modified by Mike Taves)

TL; DR: for float ASC rasters, ensure the first pixel value has a ., e.g.

…
cellsize     1.000000000000
 0. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
…

ESRI ASCII Grid files (ASC) do not explicitly store their datatypes, so when ASC rasters are opened by GDAL or other software, the data type is evaluated from some/all of the pixel data to see if there is a . character.

While GDAL is fairly robust at correctly interpreting if a raster is integer or float type, other software such as ArcGIS is not. For instance, a raster that is mostly zero is interpreted by ArcGIS as signed integer. But modify the first pixel of the ASC file from 0 to 0. corrects the interpretation to floating point. (This is not an issue with GDAL, which evaluates 100% of the data, not 100 kB as documented).

Comparison of Arc ASCII Grid files in ArcGIS 10.0

A suggestion for writing float rasters is to check if the formatted string of the first pixel of the first line has a . character. If not, and the value is finite (not NaN, Inf, etc.), append a . to that first value.

Attachments (1)

Comparison_of_asc.png (13.4 KB ) - added by Mike Taves 9 years ago.
Comparison of Arc ASCII Grid files in ArcGIS 10.0

Download all attachments as: .zip

Change History (3)

by Mike Taves, 9 years ago

Attachment: Comparison_of_asc.png added

Comparison of Arc ASCII Grid files in ArcGIS 10.0

comment:1 by Mike Taves, 9 years ago

Description: modified (diff)

comment:2 by Even Rouault, 9 years ago

Keywords: aaigrid added
Milestone: 2.0.1
Resolution: fixed
Status: newclosed

trunk r29613, branches/2.0 r29614 "AAIGRID writer: when writing with floating-point values, ensure at least one value has a decimal point to avoid issues with some readers (#6060)"

Note: See TracTickets for help on using tickets.