final CoordinateReferenceSystem nativeCRS = reader.getCoordinateReferenceSystem();
if(!CRS.equalsIgnoreMetadata(requestCRS, nativeCRS)) {
requestedEnvelope = CRS.transform(requestedEnvelope, nativeCRS);
}
// intersect with the native envelope, we cannot read outside of it
requestedEnvelope.intersect(reader.getOriginalEnvelope());
// check if we are still reading anything
if(!requestedEnvelope.isEmpty()) {
MathTransform crsToGrid = meta.getGrid().getGridToCRS().inverse();
GeneralEnvelope requestedGrid = CRS.transform(crsToGrid, requestedEnvelope);