Opened 9 years ago

Last modified 9 years ago

#6060 closed enhancement

AAIGrid: writing float types should ensure that a decimal is in the first pixel — at Version 1

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.

Change History (2)

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)
Note: See TracTickets for help on using tickets.