sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Normalize GeographicBoundingBox longitude values to [-180 … 180] range.
Date Mon, 17 Dec 2018 16:15:54 GMT
This is an automated email from the ASF dual-hosted git repository.

desruisseaux pushed a commit to branch geoapi-4.0
in repository https://gitbox.apache.org/repos/asf/sis.git


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new e882a60  Normalize GeographicBoundingBox longitude values to [-180 … 180] range.
e882a60 is described below

commit e882a60ab6b90309c3b4815ab533a96f6a6477d9
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Mon Dec 17 17:15:28 2018 +0100

    Normalize GeographicBoundingBox longitude values to [-180 … 180] range.
---
 .../org/apache/sis/internal/referencing/ServicesForMetadata.java  | 8 ++++++++
 .../main/java/org/apache/sis/referencing/cs/AxesConvention.java   | 7 +++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
index ecdd8a1..46b34cd 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ServicesForMetadata.java
@@ -87,6 +87,7 @@ import org.apache.sis.metadata.iso.extent.DefaultVerticalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultSpatialTemporalExtent;
 import org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox;
+import org.apache.sis.measure.Longitude;
 import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.internal.metadata.ReferencingServices;
 import org.apache.sis.internal.referencing.provider.Affine;
@@ -202,6 +203,13 @@ public final class ServicesForMetadata extends ReferencingServices {
             westBoundLongitude += rotation;
             eastBoundLongitude += rotation;
         }
+        if (eastBoundLongitude - westBoundLongitude >= 360) {
+            westBoundLongitude = Longitude.MIN_VALUE;
+            eastBoundLongitude = Longitude.MAX_VALUE;
+        } else {
+            westBoundLongitude = Longitude.normalize(westBoundLongitude);
+            eastBoundLongitude = Longitude.normalize(eastBoundLongitude);
+        }
         if (target == null) {
             target = new DefaultGeographicBoundingBox();
         }
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
index 1862631..3c49cf0 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/cs/AxesConvention.java
@@ -129,10 +129,9 @@ public enum AxesConvention implements AxisFilter {
      *   </li>
      * </ul>
      *
-     * Current implementation does not normalize longitude values to the [-180 … +180]°
range and does not set
-     * the {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum#getPrimeMeridian()
prime meridian}
-     * to Greenwich. However those rules may be adjusted in future SIS versions based on
experience gained.
-     * For more predictable results, consider using {@link #CONVENTIONALLY_ORIENTED} or {@link
#RIGHT_HANDED} instead.
+     * This mode does not normalize longitude values to the [-180 … +180]° range and does
not set the
+     * {@linkplain org.apache.sis.referencing.datum.DefaultGeodeticDatum#getPrimeMeridian()
prime meridian} to Greenwich.
+     * Those changes are not applied for avoiding discontinuity in conversions from the non-normalized
CRS to the normalized CRS.
      *
      * <div class="note"><b>Rational:</b>
      * The reason why we do not yet normalize the range and the prime meridian is because
doing so


Mime
View raw message