You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/07/03 18:20:05 UTC
svn commit: r1689043 - in /sis/branches/JDK8/core:
sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
Author: desruisseaux
Date: Fri Jul 3 16:20:05 2015
New Revision: 1689043
URL: http://svn.apache.org/r1689043
Log:
Default axis order is (longitude,latitude) in WKT 1 but (latitude,longitude) in WKT 2.
Modified:
sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java?rev=1689043&r1=1689042&r2=1689043&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/io/wkt/GeodeticObjectParser.java [UTF-8] Fri Jul 3 16:20:05 2015
@@ -705,11 +705,13 @@ final class GeodeticObjectParser extends
if (type == null) {
throw parent.missingComponent(WKTKeywords.Axis);
}
- String nx = null, x = null; // Easting or Longitude axis name and abbreviation.
- String ny = null, y = null; // Northing or latitude axis name and abbreviation.
- String nz = null, z = null; // Depth, height or time axis name and abbreviation.
- AxisDirection direction = null; // Depth, height or time axis direction.
- Unit<?> unit = defaultUnit; // Depth, height or time axis unit.
+ String nx = null, x = null; // Easting or Longitude axis name and abbreviation.
+ String ny = null, y = null; // Northing or latitude axis name and abbreviation.
+ String nz = null, z = null; // Depth, height or time axis name and abbreviation.
+ AxisDirection dx = AxisDirection.EAST;
+ AxisDirection dy = AxisDirection.NORTH;
+ AxisDirection direction = null; // Depth, height or time axis direction.
+ Unit<?> unit = defaultUnit; // Depth, height or time axis unit.
switch (type) {
/*
* Cartesian — we can create axes only for geodetic datum, in which case the axes are for
@@ -736,14 +738,22 @@ final class GeodeticObjectParser extends
}
/*
* Ellipsoidal — can be two- or three- dimensional, in which case the height can
- * only be ellipsoidal height.
+ * only be ellipsoidal height. The default axis order depends on the WKT version:
+ *
+ * - WKT 1 said explicitely that the default order is (longitude, latitude).
+ * - WKT 2 has no default, and allows only (latitude, longitude) order.
*/
case WKTKeywords.ellipsoidal: {
if (defaultUnit == null) {
throw parent.missingComponent(WKTKeywords.AngleUnit);
}
- nx = AxisNames.GEODETIC_LONGITUDE; x = "λ";
- ny = AxisNames.GEODETIC_LATITUDE; y = "φ";
+ if (isWKT1) {
+ nx = AxisNames.GEODETIC_LONGITUDE; x = "λ";
+ ny = AxisNames.GEODETIC_LATITUDE; y = "φ";
+ } else {
+ nx = AxisNames.GEODETIC_LATITUDE; x = "φ"; dx = AxisDirection.NORTH;
+ ny = AxisNames.GEODETIC_LONGITUDE; y = "λ"; dy = AxisDirection.EAST;
+ }
if (dimension >= 3) {
direction = AxisDirection.UP;
z = "h";
@@ -801,8 +811,8 @@ final class GeodeticObjectParser extends
}
int i = 0;
axes = new CoordinateSystemAxis[dimension];
- if (x != null && i < dimension) axes[i++] = csFactory.createCoordinateSystemAxis(singletonMap(CoordinateSystemAxis.NAME_KEY, nx), x, AxisDirection.EAST, defaultUnit);
- if (y != null && i < dimension) axes[i++] = csFactory.createCoordinateSystemAxis(singletonMap(CoordinateSystemAxis.NAME_KEY, ny), y, AxisDirection.NORTH, defaultUnit);
+ if (x != null && i < dimension) axes[i++] = csFactory.createCoordinateSystemAxis(singletonMap(CoordinateSystemAxis.NAME_KEY, nx), x, dx, defaultUnit);
+ if (y != null && i < dimension) axes[i++] = csFactory.createCoordinateSystemAxis(singletonMap(CoordinateSystemAxis.NAME_KEY, ny), y, dy, defaultUnit);
if (z != null && i < dimension) axes[i++] = csFactory.createCoordinateSystemAxis(singletonMap(CoordinateSystemAxis.NAME_KEY, nz), z, direction, unit);
// Not a problem if the array does not have the expected length for the CS type. This will be verified below in this method.
}
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java?rev=1689043&r1=1689042&r2=1689043&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/io/wkt/WKTFormatTest.java [UTF-8] Fri Jul 3 16:20:05 2015
@@ -167,7 +167,9 @@ public final strictfp class WKTFormatTes
+ "GEOGCS[“NAD27”,"
+ "DATUM[“North American Datum 1927”,"
+ "SPHEROID[“Clarke 1866”, 6378206.4, 294.97869821]],"
- + "UNIT[“degree”,0.0174532925199433]],"
+ + "UNIT[“degree”,0.0174532925199433],"
+ + "AXIS[“Lat”,NORTH],"
+ + "AXIS[“Long”,EAST]],"
+ "PROJECTION[“Lambert_Conformal_Conic_2SP”],"
+ "PARAMETER[“latitude_of_origin”,27.83333333333333],"
+ "PARAMETER[“central_meridian”,-99.0],"