Question

How to maintain precision/accuracy of pixel values when writing to Esri ASCII Grid?


Badge +3

Hi,

 

I was asked to write a raster of an Digital Terrain Model to an Esri ASCII Grid file. However, the aim of the end user was to maintain a precision of 3 decimal values for the pixel values, so that the file size would not get too large.

 

To illustrate the question I created a short sample workspace.

imageA visual preview of the RasterNumericCreators result is shown below;

imageAt the red dot (row,col) = (0,2), we can see that the pixel value is equal to '0.0250313' (using a ~'data value encoding' of 'Real32').

imageAfter the RasterCellValueRounder, we see that the value for this specific pixel is changed to '0.025' (as desired);

imageHowever, when I write out the Raster to Esri ASCII Grid, and open the result in a text editer, I see the following (only first rows/columns shown);

image.pngSpecifically, the indicated pixel is written out with a value of '0.02503128908574581'.

 

For this dummy file, the file size is 9.54 kb. If however I manually update the raster file so that the pixels are written out with a precision of 3 decimals, like such;

imageThe file size is reduced to 5.51 kb.

 

Thus, when the values would be written out with a precision of 3 decimal places, the file size is reduced with more than 42%

For these demo files the absolute file size of these ASCII Grid files is of course really low, but you can imagine that for the actual raster files (Digital Terrain Models), a reduction of 42% in the filesize will make a sizeable difference.

 

In this case the application that is reading in the ASCII Grid files takes a long time to read/process the Real64 encoded ASCII Grid files that are created by FME (for some reason the writer seems to convert to Real64), and reducing the filesize would make the files better manageable in their software.

 

I was already thinking about workarounds to deal with this problem. I have some seperate questions about (the efficiency of) these workarounds. To keep the question to the point however, I think it might be best to create community questions about this, which I will add links to below (at a later stage).

 

For this main question I'm mainly concerned if there are some obvious things I'm overlooking, and whether the gist of this question could be tackled in some straightforward way. I don't really see any parameters for the Esri ASCII Grid writer where I can control the pixel/number accuracy (or the interpretation, which seems to be fixed to Real64 in this writer).

 

Kind regards,

 

Thijs


3 replies

Badge +3

Just a heads up, I created this community question to discuss efficient workarounds to deal with this question.

hello

Just a heads up, I created this community question to discuss efficient workarounds to deal with this question.

Bereiten Sie sich auf stilvolles und praktisches Reisen vor – entdecken Sie unseren exklusiven Koffer! Mit seinem modernen Design und hochwertigen Materialien ist dieser Koffer von www.koffer7.de der perfekte Begleiter für Ihre Reiseabenteuer.

Unser Koffer bietet nicht nur ausreichend Platz für all Ihre persönlichen Gegenstände, sondern auch innovative Funktionen, die das Reisen erleichtern. Die robuste Hartschale schützt Ihre Sachen vor Stößen und Erschütterungen, während die leichtgängigen Rollen eine mühelose Navigation durch Flughäfen und Bahnhöfe ermöglichen. Das erweiterbare Design sorgt für zusätzlichen Stauraum, falls Sie einmal mehr mitnehmen möchten.

Reply