Wednesday, August 27, 2008

How to read a grass raster and script on it

I just added a command to the console commands list. Currently it can read grass raster.

The console scripting code:

jgrass {
$map = --igrass-in bacino_brenta_pit --ograss-out *

rasterData = map.getJGrassRasterData();

rows = rasterData.getRows();
cols = rasterData.getCols();

println rows + " " + cols;

for (i in 0..rows) {
for (j in 0..cols){
print rasterData.getValueAt(i, j) + " ";
println "";

Please note that groovy really doesn't need type declaration.

Well on the raster data you could do some nice calculus:

No comments: