Skip to content

Commit

Permalink
fixes #3035
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaillandier committed Oct 12, 2021
1 parent c2c9b9e commit e904f17
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -208,24 +208,26 @@ public GamaSpatialMatrix(final IScope scope, final IList<GamaGridFile> gfiles, f

this.nbBands = gfiles.size();
bands = new ArrayList<>();

String initCRS = new ArrayList<>(gfile.getGis(scope).getInitialCRS(scope).getIdentifiers()).get(0).toString();
List<String> crsF = new ArrayList<>();
List<Envelope3D> envF = new ArrayList<>();

for (int j = 1; j < gfiles.size(); j++) {
crsF.add(new ArrayList<>(gfiles.get(j).getGis(scope).getInitialCRS(scope).getIdentifiers()).get(0)
.toString());
envF.add(gfiles.get(j).computeEnvelope(scope));
}

for (int i = 0; i < matrix.length; i++) {
final IList vals = GamaListFactory.create(Types.FLOAT);
vals.add(gridValue[i]);
for (int j = 1; j < gfiles.size(); j++) {
final GamaGridFile gfile2 = gfiles.get(j);
String taCRS = crsF.get(j - 1);
GamaPoint loc = matrix[i].getLocation();
if (initCRS != null && taCRS != null) {
IShape s = Projections.transform_CRS(scope, loc, initCRS, taCRS);
if (s != null) { loc = s.getLocation(); }

if (initCRS != null && taCRS != null ) {
loc = Projections.transform_CRS(scope, loc, taCRS).getLocation();
}
final Double v = gfile2.valueOf(scope, loc);
vals.add(v);
Expand Down
2 changes: 1 addition & 1 deletion msi.gama.core/src/msi/gama/util/file/GamaGridFile.java
Expand Up @@ -670,7 +670,7 @@ public Double valueOf(final IScope scope, final double x, final double y) {
if (getBuffer() == null) { fillBuffer(scope); }
Object vals = null;
try {
vals = coverage.evaluate(new DirectPosition2D(x, y));
vals = coverage.evaluate(new DirectPosition2D(x, y));
} catch (final Exception e) {
vals = noData.doubleValue();
}
Expand Down

0 comments on commit e904f17

Please sign in to comment.