Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.5, 0.6, 0.7
-
None
Description
There is at least two conventions regarding the range of longitude values: -180° to 180° or 0° to 360°. The range is specified with CoordinateSystemAxis minimum and maximum attributes. Most of the times, we use the -180° to +180° convention. However when an envelope is transformed with Envelopes.transform(CoordinateOperation, Envelope) method, if the longitude range declared in the coordinate system changes, we expect the envelope longitude values to be updated accordingly.
We could invoke GeneralEnvelope.normalize() after envelope transformation, but we don't want to invoke it systematically. If the CoordinateOperation does not change the longitude range, then it is safer to let the longitude values as we found them, even if they are slightly outside the expected range. Example:
- If source CRS uses longitudes in the [-180 … +180]° range and target CRS uses longitudes are in the [-180 … +180]° range, then do nothing. Even if the transformation result is an envelope spanning 175° to 185° of longitude, leave it as-is because the original envelope was probably already crossing the anti-meridian (not necessarily using longitudes; we can cross the anti-meridian with the Mercator projection too).
- If source CRS uses longitudes in the [0 … 360]° range and target CRS uses longitudes are in the [0 … 360]° range, do nothing for the same reason than above.
- If source CRS uses longitudes in the [-180 … +180]° range and target CRS uses longitudes are in the [0 … 360]° range, then if the envelope result is outside the [0 … 360]° range, brings it back to the [0 … 360]° range as described in GeneralEnvelope.normalize().
- If source CRS uses longitudes in the [0 … 360]° range and target CRS uses longitudes are in the [-180 … +180]° range, then if the envelope result is outside the [-180 … +180]° range, brings it back to the [-180 … +180]° range.