Ensures that the envelope is contained in the coordinate system domain.
For each dimension, this method compares the ordinate values against the
limits of the coordinate system axis for that dimension.
If some ordinates are out of range, then there is a choice depending on the
CoordinateSystemAxis#getRangeMeaning():
- If
RangeMeaning#EXACT (typically latitudes ordinates), then values
greater than the
CoordinateSystemAxis#getMaximumValue()are replaced by the axis maximum, and values smaller than the
CoordinateSystemAxis#getMinimumValue()are replaced by the axis minimum.
- If
RangeMeaning#WRAPAROUND (typically longitudes ordinates), then
a multiple of the axis range (e.g. 360° for longitudes) is added or subtracted.
Example:
- the [190 … 200]° longitude range is converted to [-170 … -160]°,
- the [170 … 200]° longitude range is converted to [+170 … -160]°.
See Spanning the anti-meridian of a Geographic CRS in the
class javadoc for more information about the meaning of such range.
Spanning the anti-meridian of a Geographic CRS
If the envelope is spanning the anti-meridian, then some
#getLower(int)ordinate values may become greater than their
#getUpper(int) counterpart
as a result of this method call. If such effect is undesirable, then this method may be
combined with
#simplify() as below:
javaif (envelope.normalize())
envelope.simplify();
}
}
Choosing the range of longitude values
Geographic CRS typically have longitude values in the [-180 … +180]° range, but the [0 … 360]°
range is also occasionally used. Callers need to ensure that this envelope CRS is associated
to axes having the desired
CoordinateSystemAxis#getMinimumValue() and
CoordinateSystemAxis#getMaximumValue().
Usage
This method is sometime useful before to compute the
#add(Envelope)or
#intersect(Envelope) of envelopes, in order to ensure that
both envelopes are defined in the same domain. This method may also be invoked before
to project an envelope, since some projections produce
Double#NaN numbers when
given an ordinate value out of bounds.