final int expected = getDimension();
final int dimension = crs.getCoordinateSystem().getDimension();
if (dimension > expected) {
// check dimensions and choose ReferencedEnvelope or ReferencedEnvelope3D
// or the factory method ReferencedEnvelope.reference( CoordinateReferenceSystem )
throw new MismatchedDimensionException(Errors.format(
ErrorKeys.MISMATCHED_DIMENSION_$3, crs.getName().getCode(),
new Integer(dimension), new Integer(expected)));
}
}
}