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 2017/02/16 06:14:18 UTC
svn commit: r1783173 - in /sis/branches/JDK8:
core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/
core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/
core/sis-referencing/src/main/java/org/apache/sis/ref...
Author: desruisseaux
Date: Thu Feb 16 06:14:17 2017
New Revision: 1783173
URL: http://svn.apache.org/viewvc?rev=1783173&view=rev
Log:
Support Norway and Svalbard special cases at the source (in the UTM) methods rather than in MGRS only.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MGRSEncoder.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/package-info.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MGRSEncoderTest.java
sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
sis/branches/JDK8/src/main/javadoc/stylesheet.css
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -238,11 +238,16 @@ public class GeodeticObjectBuilder exten
* <tr><td>False northing</td> <td>0 (North hemisphere) or 10000000 (South hemisphere) metres</td></tr>
* </table></blockquote>
*
+ * Note that calculation of UTM zone contains special cases for Norway and Svalbard.
+ * If not desired, those exceptions can be avoided by making sure that the given latitude is below 56�N.
+ *
* @param isUTM if {@code true}, the given central meridian will be snapped to the central meridian of a UTM zone.
* @param latitude the latitude in the center of the desired projection.
* @param longitude the longitude in the center of the desired projection.
* @return {@code this}, for method calls chaining.
* @throws FactoryException if the operation method for the Transverse Mercator projection can not be obtained.
+ *
+ * @see CommonCRS#UTM(double, double)
*/
public GeodeticObjectBuilder setTransverseMercator(boolean isUTM, double latitude, double longitude)
throws FactoryException
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/PolarStereographicA.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -31,6 +31,7 @@ import org.apache.sis.measure.Units;
/**
* The provider for <cite>"Polar Stereographic (Variant A)"</cite> projection (EPSG:9810).
+ * Also used for the definition of Universal Polar Stereographic (UPS) projection.
*
* @author Rueben Schulz (UBC)
* @author Martin Desruisseaux (Geomatys)
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/TransverseMercator.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -142,6 +142,7 @@ public final class TransverseMercator ex
public static enum Zoner {
/**
* Computes zones for the Universal Transverse Mercator (UTM) projections.
+ * This computation includes special cases for Norway and Svalbard.
*
* <blockquote><table class="sis">
* <caption>Universal Transverse Mercator parameters</caption>
@@ -153,7 +154,24 @@ public final class TransverseMercator ex
* <tr><td>False northing</td> <td>0 (North hemisphere) or 10000000 (South hemisphere) metres</td></tr>
* </table></blockquote>
*/
- UTM(Longitude.MIN_VALUE, 6, 0.9996, 500000, 10000000),
+ UTM(Longitude.MIN_VALUE, 6, 0.9996, 500000, 10000000) {
+ @Override public int zone(final double \u03c6, final double \u03bb) {
+ int zone = super.zone(\u03c6, \u03bb);
+ switch (zone) {
+ /*
+ * Between 56� and 64�, zone 32 is widened to 9� at the expense of zone 31 to accommodate Norway.
+ * Between 72� and 84�, zones 33 and 35 are widened to 12� to accommodate Svalbard. To compensate,
+ * zones 31 and 37 are widened to 9� and zones 32, 34, and 36 are eliminated.
+ * In this switch statement, only the zones that are reduced or eliminated needs to appear.
+ */
+ case 31: if (isNorway (\u03c6)) {if (\u03bb >= 3) zone++; } break; // 3� is zone 31 central meridian.
+ case 32: if (isSvalbard(\u03c6)) {if (\u03bb >= 9) zone++; else zone--;} break; // 9� is zone 32 central meridian.
+ case 34: if (isSvalbard(\u03c6)) {if (\u03bb >= 21) zone++; else zone--;} break; // 21� is zone 34 central meridian.
+ case 36: if (isSvalbard(\u03c6)) {if (\u03bb >= 33) zone++; else zone--;} break; // 33� is zone 36 central meridian.
+ }
+ return zone;
+ }
+ },
/**
* Computes zones for the Modified Transverse Mercator (MTM) projections.
@@ -236,7 +254,7 @@ public final class TransverseMercator ex
final boolean zoned, double latitude, double longitude)
{
final boolean isSouth = MathFunctions.isNegative(latitude);
- int zone = zone(longitude);
+ int zone = zone(latitude, longitude);
if (zoned) {
latitude = 0;
longitude = centralMeridian(zone);
@@ -272,7 +290,7 @@ public final class TransverseMercator ex
final boolean isNorth = Numerics.epsilonEqual(v, 0, Formulas.LINEAR_TOLERANCE);
if (isNorth || Numerics.epsilonEqual(v, northing, Formulas.LINEAR_TOLERANCE)) {
v = group.parameter(Constants.CENTRAL_MERIDIAN).doubleValue(Units.DEGREE);
- int zone = zone(v);
+ int zone = zone(0, v);
if (Numerics.epsilonEqual(centralMeridian(zone), v, Formulas.ANGULAR_TOLERANCE)) {
if (!isNorth) zone = -zone;
return zone;
@@ -285,16 +303,17 @@ public final class TransverseMercator ex
/**
* Computes the zone from a meridian in the zone.
*
- * @param longitude a meridian inside the desired zone, in degrees relative to Greenwich.
- * Positive longitudes are toward east, and negative longitudes toward west.
+ * @param \u03c6 a latitude for which to get the zone. Used for taking in account the special cases.
+ * @param \u03bb a meridian inside the desired zone, in degrees relative to Greenwich.
+ * Positive longitudes are toward east, and negative longitudes toward west.
* @return the zone number numbered from 1 inclusive, or 0 if the given central meridian was NaN.
*/
- public final int zone(double longitude) {
+ public int zone(final double \u03c6, final double \u03bb) {
/*
* Casts to int are equivalent to Math.floor(double) for positive values, which is guaranteed
* to be the case here since we normalize the central meridian to the [MIN_VALUE \u2026 MAX_VALUE] range.
*/
- double z = (longitude - origin) / width; // Zone number with fractional part.
+ double z = (\u03bb - origin) / width; // Zone number with fractional part.
z -= Math.floor(z / ((Longitude.MAX_VALUE - Longitude.MIN_VALUE) / width)) // Roll in the [0 \u2026 60) range.
* ((Longitude.MAX_VALUE - Longitude.MIN_VALUE) / width);
return (int) (z + 1); // Cast only after addition in order to handle NaN as documented.
@@ -309,5 +328,27 @@ public final class TransverseMercator ex
public final double centralMeridian(final int zone) {
return (zone - 0.5) * width + origin;
}
+
+ /**
+ * First exception in UTM projection, corresponding to latitude band V.
+ * This method is public for {@code MGRSEncoderTest.verifyZonerConsistency()} purpose only.
+ *
+ * @param \u03c6 the latitude in degrees to test.
+ * @return whether the given latitude is in the Norway latitude band.
+ */
+ public static boolean isNorway(final double \u03c6) {
+ return (\u03c6 >= 56) && (\u03c6 < 64);
+ }
+
+ /**
+ * Second exception in UTM projection, corresponding to latitude band X.
+ * This method is public for {@code MGRSEncoderTest.verifyZonerConsistency()} purpose only.
+ *
+ * @param \u03c6 the latitude in degrees to test.
+ * @return whether the given latitude is in the Svalbard latitude band.
+ */
+ public static boolean isSvalbard(final double \u03c6) {
+ return (\u03c6 >= 72) && (\u03c6 < 84);
+ }
}
}
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/CommonCRS.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -431,13 +431,15 @@ public enum CommonCRS {
* or an instance of {@link org.opengis.referencing.crs.CompoundCRS}
* with an {@linkplain CRS#getHorizontalComponent horizontal component}.</li>
* <li>The {@code crs} or the horizontal component of {@code crs} is associated to a {@link GeodeticDatum}.</li>
- * <li>The geodetic datum has the same EPSG code than one of the {@code CommonCRS}�enumeration values,
- * or has no EPSG code but is {@linkplain Utilities#equalsIgnoreMetadata equal, ignoring metadata},
+ * <li>The geodetic datum either<ul>
+ * <li>has the same EPSG code than one of the {@code CommonCRS}�enumeration values, or</li>
+ * <li>has no EPSG code but is {@linkplain Utilities#equalsIgnoreMetadata equal, ignoring metadata},
* to the {@link #datum()} value of one of the {@code CommonCRS}�enumeration values.</li>
+ * </ul></li>
* </ul>
*
* This method is useful for easier creation of various coordinate reference systems through the
- * {@link #geographic()}, {@link #geocentric()} and other convenience methods when the set of datum
+ * {@link #geographic()}, {@link #geocentric()} or other convenience methods when the set of datums
* supported by {@code CommonCRS} is known to be sufficient.
*
* @param crs the coordinate reference system for which to get a {@code CommonCRS} value.
@@ -959,16 +961,29 @@ public enum CommonCRS {
* There is a total of 120 UTM zones, with 60 zones in the North hemisphere and 60 zones in the South hemisphere.
* The projection zone is determined from the arguments as below:
*
- * <ul>
+ * <ul class="verbose">
* <li>The sign of the <var>latitude</var> argument determines the hemisphere:
* North for positive latitudes (including positive zero) or
* South for negative latitudes (including negative zero).
- * The latitude magnitude is ignored, except for ensuring that the latitude is inside the [-90 \u2026 90]� range.</li>
+ * The latitude magnitude is ignored, except for the special cases documented below
+ * and for ensuring that the latitude is inside the [-90 \u2026 90]� range.</li>
* <li>The value of the <var>longitude</var> argument determines the 6�-width zone,
* numbered from 1 for the zone starting at 180�W up to 60 for the zone finishing at 180�E.
* Longitudes outside the [-180 \u2026 180]� range will be rolled as needed before to compute the zone.</li>
+ * <li>Calculation of UTM zone involves two special cases:
+ * <ul>
+ * <li>Between 56�N and 64�N, zone 32 is widened to 9� (at the expense of zone 31)
+ * to accommodate southwest Norway.</li>
+ * <li>Between 72�N and 84�N, zones 33 and 35 are widened to 12� to accommodate Svalbard.
+ * To compensate for these 12� wide zones, zones 31 and 37 are widened to 9� and
+ * zones 32, 34, and 36 are eliminated.</li>
+ * </ul>
+ * </li>
* </ul>
*
+ * If the special cases for Norway and Svalbard are not desired, they can be avoided by making sure
+ * that the given latitude is below 56�N.
+ *
* <div class="note"><b>Warning:</b>
* be aware of parameter order! For this method, latitude is first.
* This order is for consistency with the non-normalized {@linkplain #geographic() geographic} CRS
@@ -998,7 +1013,7 @@ public enum CommonCRS {
ArgumentChecks.ensureBetween("latitude", Latitude.MIN_VALUE, Latitude.MAX_VALUE, latitude);
ArgumentChecks.ensureBetween("longitude", -Formulas.LONGITUDE_MAX, Formulas.LONGITUDE_MAX, longitude);
final boolean isSouth = MathFunctions.isNegative(latitude);
- final int zone = TransverseMercator.Zoner.UTM.zone(longitude);
+ final int zone = TransverseMercator.Zoner.UTM.zone(latitude, longitude);
final Integer key = isSouth ? -zone : zone;
ProjectedCRS crs;
synchronized (cachedUTM) {
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/factory/CommonAuthorityFactory.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -587,7 +587,7 @@ public class CommonAuthorityFactory exte
* 42005: WGS 84 / Auto Mollweide \u2014 defined by "Central_Meridian" only.
*/
case 42001: isUTM = true; break;
- case 42002: isUTM = (latitude == 0) && (UTM.centralMeridian(UTM.zone(longitude)) == longitude); break;
+ case 42002: isUTM = (latitude == 0) && (UTM.centralMeridian(UTM.zone(0, longitude)) == longitude); break;
case 42003: method = "Orthographic"; param = Constants.LATITUDE_OF_ORIGIN; break;
case 42004: method = "Equirectangular"; param = Constants.STANDARD_PARALLEL_1; break;
case 42005: method = "Mollweide"; break;
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MGRSEncoder.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MGRSEncoder.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MGRSEncoder.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MGRSEncoder.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -63,12 +63,12 @@ final class MGRSEncoder {
/**
* Southernmost bound of the first latitude band ({@code 'C'}).
*/
- private static final double UTM_SOUTH_BOUNDS = -80;
+ static final double UTM_SOUTH_BOUNDS = -80;
/**
* Northernmost bound of the last latitude band ({@code 'X'}).
*/
- private static final double UTM_NORTH_BOUNDS = 84;
+ static final double UTM_NORTH_BOUNDS = 84;
/**
* Special {@link #crsZone} value for the UPS South (Universal Polar Stereographic) projection.
@@ -253,47 +253,6 @@ final class MGRSEncoder {
}
/**
- * Computes the UTM zone for the given longitude and latitude band.
- * Those zones are normally the same than UTM, except for Norway and
- * Svalbard which have special rules.
- *
- * @param band the latitude band computed by {@link #latitudeBand(double)}.
- * @param \u03bb the longitude for which to compute the UTM zone.
- * @return the UTM zone for the given longitude, or 0 if the given longitude is NaN or infinite.
- */
- static int zone(final double \u03bb, final char band) {
- int zone = TransverseMercator.Zoner.UTM.zone(\u03bb);
- switch (band) {
- /*
- * Zone 32 has been widened to 9� (at the expense of zone 31)
- * between latitudes 56� and 64� to accommodate southwest Norway.
- */
- case 'V': {
- if (zone == 31 && \u03bb >= 3) zone++; // 3� is the central meridian of zone 31.
- break;
- }
- /*
- * Between 72� and 84�, zones 33 and 35 have been widened to 12� to accommodate Svalbard.
- * To compensate for these 12� wide zones, zones 31 and 37 are widened to 9� and zones 32,
- * 34, and 36 are eliminated.
- */
- case 'X': {
- switch (zone) {
- case 32: if (\u03bb >= 9) zone++; else zone--; break; // 9� is zone 32 central meridian.
- case 34: if (\u03bb >= 21) zone++; else zone--; break; // 21� is zone 34 central meridian.
- case 36: if (\u03bb >= 33) zone++; else zone--; break; // 33� is zone 36 central meridian.
- }
- break;
- }
- }
- if (zone == 0) {
- throw new IllegalArgumentException(Errors.format(Errors.Keys.NotANumber_1, "\u03bb"));
- }
- assert zone >= 1 && zone <= 60 : zone;
- return zone;
- }
-
- /**
* Encodes the given position into a MGRS label. It is caller responsibility to ensure that the
* position CRS is the same than the CRS specified at this {@code MGRSEncoder} creation time.
*
@@ -317,20 +276,23 @@ final class MGRSEncoder {
/*
* Universal Transverse Mercator (UTM) case.
*/
- final char band = latitudeBand(\u03c6);
- final int zone = zone(geographic.getOrdinate(1), band);
- final int sz = MathFunctions.isNegative(\u03c6) ? -zone : zone; // Never zero.
+ final double \u03bb = geographic.getOrdinate(1);
+ final int zone = TransverseMercator.Zoner.UTM.zone(\u03c6, \u03bb);
+ final int sz = MathFunctions.isNegative(\u03c6) ? -zone : zone;
+ if (sz == 0) {
+ // Zero value at this point is the result of NaN of infinite ordinate value.
+ throw new GazetteerException(Errors.format(Errors.Keys.NotANumber_1, "longitude"));
+ }
if (sz != crsZone) {
if (sz != actualZone) {
- double cm = TransverseMercator.Zoner.UTM.centralMeridian(zone);
- actualZone = 0; // In case an exception is thrown on the next line.
- toActualZone = CRS.findOperation(datum.geographic(), datum.UTM(\u03c6, cm), null).getMathTransform();
+ actualZone = 0; // In case an exception is thrown on the next line.
+ toActualZone = CRS.findOperation(datum.geographic(), datum.UTM(\u03c6, \u03bb), null).getMathTransform();
actualZone = sz;
}
owner.normalized = position = toActualZone.transform(geographic, owner.normalized);
}
buffer.setLength(0);
- buffer.append(zone).append(separator).append(band);
+ buffer.append(zone).append(separator).append(latitudeBand(\u03c6));
if (digits >= 0) {
/*
* Specification said that 100,000-meters columns are lettered from A through Z (omitting I and O)
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystem.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -33,13 +33,14 @@ import org.apache.sis.util.resources.Err
/**
* The Military Grid Reference System (MGRS).
* The MGRS is the geocoordinate standard used by NATO militaries for locating points on the earth.
- * It is based on the Universal Transverse Mercator (UTM) and the polar stereographic projections.
- * Despite its name, MGRS is not used only for military purposes; it is used also for organizing
- * Earth Observation data in a directory tree on some cloud storages for example.
+ * It is based on the Universal Transverse Mercator (UTM) and the Universal Polar Stereographic (UPS) projections.
+ * Despite its name, MGRS is used not only for military purposes; it is used also for organizing Earth Observation
+ * data in directory trees for example.
*
* <div class="section">Immutability and thread safety</div>
- * This class is immutable and thus thread-safe. However the {@code Coder} performing conversions
- * between labels and coordinates are not thread-safe; a new instance must be created for each thread.
+ * This class is immutable and thus thread-safe.
+ * However the {@link Coder Coder} instances performing conversions between labels and coordinates are not thread-safe;
+ * it is recommended to create a new {@code Coder} instance for each thread.
*
* @author Martin Desruisseaux (Geomatys)
* @since 0.8
@@ -143,13 +144,13 @@ public class MilitaryGridReferenceSystem
* <table class="sis">
* <caption>MGRS label precisions</caption>
* <tr><th>Precision (m)</th> <th>Label example</th></tr>
- * <tr><td style="text-align:right">1</td> <td>4QFJ 12345 67890</td></tr>
- * <tr><td style="text-align:right">10</td> <td>4QFJ 1234 6789</td></tr>
- * <tr><td style="text-align:right">100</td> <td>4QFJ 123 678</td></tr>
- * <tr><td style="text-align:right">1000</td> <td>4QFJ 12 67</td></tr>
- * <tr><td style="text-align:right">10\u2009000</td> <td>4QFJ 1 6</td></tr>
- * <tr><td style="text-align:right">100\u2009000</td> <td>4QFJ</td></tr>
- * <tr><td style="text-align:right">(approximative) 1\u2009000\u2009000</td> <td>4Q</td></tr>
+ * <tr><td style="text-align:right">1</td> <td>4\u2009Q\u2009FJ\u200912345\u200967890</td></tr>
+ * <tr><td style="text-align:right">10</td> <td>4\u2009Q\u2009FJ\u20091234\u20096789</td></tr>
+ * <tr><td style="text-align:right">100</td> <td>4\u2009Q\u2009FJ\u2009123\u2009678</td></tr>
+ * <tr><td style="text-align:right">1000</td> <td>4\u2009Q\u2009FJ\u200912\u200967</td></tr>
+ * <tr><td style="text-align:right">10\u2009000</td> <td>4\u2009Q\u2009FJ\u20091\u20096</td></tr>
+ * <tr><td style="text-align:right">100\u2009000</td> <td>4\u2009Q\u2009FJ</td></tr>
+ * <tr><td style="text-align:right">(approximative) 1\u2009000\u2009000</td> <td>4\u2009Q</td></tr>
* </table>
*
* Values smaller than 1 (e.g. 0.01 for a centimetre precision) may also be returned
Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/package-info.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/package-info.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/package-info.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/gazetteer/package-info.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -21,7 +21,7 @@
* Geographic identifiers are location descriptors such as addresses and grid indexes.
* Their reference systems are defined by <cite>Spatial referencing by geographic identifiers</cite> (ISO 19112).
* Gazetteers provide linking mechanism between referencing using geographic identifiers (this package)
- * and referencing using coordinates ({@link org.apache.sis.referencing.crs} package).
+ * and referencing using coordinates (\u2026{@link org.apache.sis.referencing.crs .crs} package).
*
* @author Chris Mattmann (JPL)
* @author Martin Desruisseaux (Geomatys)
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/internal/referencing/provider/TransverseMercatorTest.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -37,13 +37,18 @@ import static org.junit.Assert.*;
*/
public final strictfp class TransverseMercatorTest extends TestCase {
/**
- * Tests {@link TransverseMercator.Zoner#zone(double)}.
+ * Tests {@link TransverseMercator.Zoner#zone(double)},
+ * including the special cases for Norway and Svalbard.
*/
@Test
public void testZone() {
- assertEquals(1, TransverseMercator.Zoner.UTM.zone(-180));
- assertEquals(10, TransverseMercator.Zoner.UTM.zone(-123));
- assertEquals(60, TransverseMercator.Zoner.UTM.zone(179.9));
+ assertEquals("180�E", 1, TransverseMercator.Zoner.UTM.zone( 0, -180 ));
+ assertEquals("123�E", 10, TransverseMercator.Zoner.UTM.zone( 0, -123 ));
+ assertEquals("179.9�W", 60, TransverseMercator.Zoner.UTM.zone( 0, 179.9));
+ assertEquals( "4�E band T", 31, TransverseMercator.Zoner.UTM.zone(45, 4 ));
+ assertEquals( "4�E band V", 32, TransverseMercator.Zoner.UTM.zone(56, 4 ));
+ assertEquals("20�E band W", 34, TransverseMercator.Zoner.UTM.zone(71, 20 ));
+ assertEquals("20�E band X", 33, TransverseMercator.Zoner.UTM.zone(72, 20 ));
}
/**
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MGRSEncoderTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MGRSEncoderTest.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MGRSEncoderTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MGRSEncoderTest.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -16,6 +16,7 @@
*/
package org.apache.sis.referencing.gazetteer;
+import org.apache.sis.internal.referencing.provider.TransverseMercator.Zoner;
import org.apache.sis.test.TestCase;
import org.junit.Test;
@@ -47,6 +48,7 @@ public final strictfp class MGRSEncoderT
@Test
public void testLatitudeBand() {
assertEquals("80�S", 'C', MGRSEncoder.latitudeBand(-80));
+ assertEquals("45�N", 'T', MGRSEncoder.latitudeBand( 45));
assertEquals("55�N", 'U', MGRSEncoder.latitudeBand( 55));
assertEquals("56�N", 'V', MGRSEncoder.latitudeBand( 56));
assertEquals("63�N", 'V', MGRSEncoder.latitudeBand( 63));
@@ -57,13 +59,17 @@ public final strictfp class MGRSEncoderT
}
/**
- * Tests {@link MGRSEncoder#zone(double, char)}.
+ * Verifies that {@link Zoner#isNorway(double)} and {@link Zoner#isSvalbard(double)}
+ * are consistent with the latitude bands.
*/
@Test
- public void testZone() {
- assertEquals( "4�E band T", 31, MGRSEncoder.zone( 4, 'T'));
- assertEquals( "4�E band V", 32, MGRSEncoder.zone( 4, 'V'));
- assertEquals("20�E band W", 34, MGRSEncoder.zone(20, 'W'));
- assertEquals("20�E band X", 33, MGRSEncoder.zone(20, 'X'));
+ public void verifyZonerConsistency() {
+ for (double \u03c6 = MGRSEncoder.UTM_SOUTH_BOUNDS; \u03c6 < MGRSEncoder.UTM_NORTH_BOUNDS; \u03c6++) {
+ final String latitude = String.valueOf(\u03c6);
+ final char band = MGRSEncoder.latitudeBand(\u03c6);
+ assertTrue (latitude, band >= 'C' && band <= 'X');
+ assertEquals(latitude, band == 'V', Zoner.isNorway(\u03c6));
+ assertEquals(latitude, band == 'X', Zoner.isSvalbard(\u03c6));
+ }
}
}
Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/gazetteer/MilitaryGridReferenceSystemTest.java [UTF-8] Thu Feb 16 06:14:17 2017
@@ -76,8 +76,9 @@ public final strictfp class MilitaryGrid
assertEquals("32GNV8410260761", coder.encode(position));
/*
* 82�N 10�E (UTM zone 32) \u2014 in this special case, zone 32 is replaced by zone 33.
+ * Call to WGS84.UTM(\u03c6,\u03bb) needs to specify a smaller latitude for getting zone 32.
*/
- position.setCoordinateReferenceSystem(CommonCRS.WGS84.UTM(82, 10));
+ position.setCoordinateReferenceSystem(CommonCRS.WGS84.UTM(40, 10));
position.x = 515537;
position.y = 9104963;
assertEquals("33XVM2240708183", coder.encode(position));
Modified: sis/branches/JDK8/src/main/javadoc/stylesheet.css
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/src/main/javadoc/stylesheet.css?rev=1783173&r1=1783172&r2=1783173&view=diff
==============================================================================
--- sis/branches/JDK8/src/main/javadoc/stylesheet.css (original)
+++ sis/branches/JDK8/src/main/javadoc/stylesheet.css Thu Feb 16 06:14:17 2017
@@ -168,7 +168,7 @@ div.description div.section {
/*
* Bullet and ordered lists. Put some space before and after the list.
- * Listes of the "verbose" class also have some space betweem items.
+ * Lists of the "verbose" class also have some space betweem items.
*/
div.block ul,
div.block ol {