public static Integer getHoles ( Geometry g ) { if ( g == null ) { return null ; } if ( g instanceof MultiPolygon ) { Polygon p = ( Polygon ) g . getGeometryN ( 0 ) ; if ( p != null ) { return p . getNumInteriorRing ( ) ; } } else if ( g instanceof Polygon ) { return ( ( Polygon ) g ) . getNumInteriorRing ( ) ; } return null ; }
Return the number of holes in a Polygon or MultiPolygon