Skip to content

Commit

Permalink
improve the robustness in shapefile reading while testing geom validity
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaillandier committed Sep 9, 2021
1 parent 03a68d4 commit fe73001
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion msi.gama.core/src/msi/gama/util/file/GamaShapeFile.java
Expand Up @@ -345,7 +345,12 @@ protected final void readShapes(final IScope scope) {
collection.accepts(feature -> {
Geometry g = (Geometry) feature.getDefaultGeometryProperty().getValue();
if (g != null && !g.isEmpty() /* Fix for Issue 725 && 677 */ ) {
if (!with3D && !g.isValid()) { g = GeometryUtils.cleanGeometry(g); }
if (!with3D && g.getNumPoints() > 2)
try {
if (!g.isValid()) { g = GeometryUtils.cleanGeometry(g); }
} catch(Exception e) {
g = GeometryUtils.cleanGeometry(g);
}
g = gis.transform(g);
if (!with3D) {
g.apply(ZERO_Z);
Expand Down

0 comments on commit fe73001

Please sign in to comment.