From 251e3973913971ab7d996ed9a8e8da0f84ee1296 Mon Sep 17 00:00:00 2001 From: jansule Date: Fri, 9 Aug 2019 16:59:18 +0200 Subject: [PATCH] Fix reading geoTiff When reading geoTiff all grid values were set to 0.0 due to commenting out relevant code. More specifically: `band.ReadRaster()` sets the values for the double array `line`. Otherwise line will only be an array of `0.0` and its values will be added to the grid, ignoring the actual values of the rasterband. This code was commented out 9 years ago in https://github.com/eclab/mason/commit/d7a644259d6b4c02aaba8b3a787a4e72da63381c. I am not sure if this fix will have side effects on that commit. --- contrib/geomason/sim/io/geo/GDALImporter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/geomason/sim/io/geo/GDALImporter.java b/contrib/geomason/sim/io/geo/GDALImporter.java index 31c939ff7..8208864df 100644 --- a/contrib/geomason/sim/io/geo/GDALImporter.java +++ b/contrib/geomason/sim/io/geo/GDALImporter.java @@ -125,7 +125,7 @@ private static void readIntegerBased(int xSize, int ySize, Band band, IntGrid2D for (int currRow = 0; currRow < ySize; currRow++) { - //result = band.ReadRaster(0, currRow, xSize, 1, line); + result = band.ReadRaster(0, currRow, xSize, 1, line); if (result != gdalconstConstants.CE_None) { throw new RuntimeException("Problem reading raster"); @@ -158,7 +158,7 @@ private static void readDoubleBased(int xSize, int ySize, Band band, DoubleGrid2 for (int currRow = 0; currRow < ySize; currRow++) { - //result = band.ReadRaster(0, currRow, xSize, 1, line); + result = band.ReadRaster(0, currRow, xSize, 1, line); if (result != gdalconstConstants.CE_None) { throw new RuntimeException("Problem reading raster");