GeographicBoundingBox box = (GeographicBoundingBox) extent2;
env = new ReferencedEnvelope(box.getWestBoundLongitude(),
box.getEastBoundLongitude(), box.getSouthBoundLatitude(),
box.getNorthBoundLatitude(), DefaultGeographicCRS.WGS84);
} else if (extent2 instanceof BoundingPolygon) {
BoundingPolygon boundingpoly = (BoundingPolygon) extent2;
Collection<? extends Geometry> polygons = boundingpoly.getPolygons();
for (Geometry geometry : polygons) {
Polygon poly = (Polygon) geometry;
org.opengis.geometry.Envelope envelope = poly.getBoundary().getEnvelope();
env = new ReferencedEnvelope(envelope.getMinimum(0), envelope.getMaximum(0),
envelope.getMinimum(1), envelope.getMaximum(1), envelope