File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
src/main/groovy/geoscript/layer Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import org.geotools.feature.FeatureCollection
26
26
import org.geotools.feature.FeatureIterator
27
27
import org.geotools.map.FeatureLayer
28
28
import org.geotools.process.vector.VectorToRasterProcess
29
+ import org.locationtech.jts.geom.TopologyException
29
30
import org.opengis.filter.sort.SortOrder
30
31
import org.opengis.feature.simple.SimpleFeatureType
31
32
import org.opengis.feature.simple.SimpleFeature
@@ -1368,7 +1369,12 @@ class Layer implements Renderable {
1368
1369
// Make sure it actually intersects the Geometry of a Feature in the spatial index
1369
1370
if (f. geom. intersects(layerFeature. geom)) {
1370
1371
// Clip the geometry from the input Layer
1371
- Geometry intersection = layerFeature. geom. intersection(f. geom)
1372
+ Geometry intersection = null
1373
+ try {
1374
+ intersection = layerFeature. geom. intersection(f. geom)
1375
+ } catch (TopologyException ex) {
1376
+ intersection = layerFeature. geom. buffer(0 ). intersection(f. geom. buffer(0 ))
1377
+ }
1372
1378
// Create a new Feature and add if to the clipped Layer
1373
1379
Map values = layerFeature. attributes
1374
1380
values[outLayer. schema. geom. name] = intersection
You can’t perform that action at this time.
0 commit comments