Submitted by dave on
I've repeatedly come across the need to read or write Raster files in Java. These are data files which represent a rectangular grid of data using ASCII representations of numbers. An example, from [1]:
ncols 157 nrows 171 xllcorner -156.08749650000 yllcorner 18.870890200000 cellsize 0.00833300 nodata_value -9999 0 0 1 1 1 2 3 3 5 6 8 9 12 14 18 21 25 30 35 41 47 53 59 66 73 79 86 92 97 102 106 109 112 113 113 113 111 109 106
All values can be doubles or ints. The magic, optional NODATA value has to be a number, or some tools complain. It's not clear whether capitalisation should or does matter.
It's a pretty horrible format, but it gets used a lot.
[www.geotools.org|GeoTools] can deal with it, but it's about a 60MB download, and it takes me quite a while to remind myself how it works.
So, I've put together a quick little raster parser on googlecode: https://code.google.com/p/java-esri-ascii/
It's not packaged for download yet, but it will be, especially if there's any interest.
