Pointer<OGREnvelope> boundsPtr = allocate(OGREnvelope.class);
int code = OGR_L_GetExtent(layer, boundsPtr, 0);
if (code == OGRERR_FAILURE) {
return null;
} else {
OGREnvelope bounds = boundsPtr.get();
return new ReferencedEnvelope(bounds.MinX(), bounds.MaxX(), bounds.MinY(),
bounds.MaxY(), crs);
}
} finally {
OGRUtils.releaseLayer(layer);
OGRUtils.releaseDataSource(dataSource);
}