Skip to content

Commit

Permalink
add a warning for the projection of grids (related to issue #3345)
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaillandier committed May 5, 2022
1 parent 313ae57 commit 456b968
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions msi.gama.core/src/msi/gama/util/file/GamaGridFile.java
Expand Up @@ -48,6 +48,7 @@
import org.opengis.parameter.GeneralParameterValue;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.crs.ProjectedCRS;

import msi.gama.common.geometry.Envelope3D;
import msi.gama.metamodel.shape.GamaPoint;
Expand Down Expand Up @@ -440,6 +441,11 @@ void read(final IScope scope, final boolean readAll, final boolean createGeometr
scope.getGui().getStatus().beginSubStatus("Reading file " + getName(scope));

final Envelope envP = gis.getProjectedEnvelope();
if (gis != null) {
if(!(gis.getInitialCRS(scope) instanceof ProjectedCRS)) {
GAMA.reportError(scope, GamaRuntimeException.warning("Try to project a grid -" + this.originalPath+ "- that is not projected. Projection of grids can lead to errors in the cell coordinates. ", scope), false);
}
}
final double cellHeight = envP.getHeight() / numRows;
final double cellWidth = envP.getWidth() / numCols;
final IList<IShape> shapes = GamaListFactory.create(Types.GEOMETRY);
Expand Down

0 comments on commit 456b968

Please sign in to comment.