public static MultiPolygon convert ( MultiPolygon multiPolygon , int dimension ) { int nb = multiPolygon . getNumGeometries ( ) ; final Polygon [ ] pl = new Polygon [ nb ] ; for ( int i = 0 ; i < nb ; i ++ ) { pl [ i ] = GeometryCoordinateDimension . convert ( ( Polygon ) multiPolygon . getGeometryN ( i ) , dimension ) ; } return gf . createMultiPolygon ( pl ) ; }
Force the dimension of the MultiPolygon and update correctly the coordinate dimension