private void removeLowerDimension ( Geometry geometry , List < Geometry > result , int dimension ) { for ( int i = 0 ; i < geometry . getNumGeometries ( ) ; i ++ ) { Geometry g = geometry . getGeometryN ( i ) ; if ( g instanceof GeometryCollection ) { removeLowerDimension ( g , result , dimension ) ; } else if ( g . getDimension ( ) >= dimension ) { result . add ( g ) ; } } }
Reursively remove geometries with a dimension less than dimension parameter