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
commit 4bce208f4d803db8d13832ea50af7bec141eb006 Author: Martin Desruisseaux <[email protected]> AuthorDate: Thu Jun 30 12:50:40 2022 +0200 Replace "Proj.4" by "PROJ" when refering to the project. We keep "Proj4" as the namespace for PROJ-specific parameters because those parameters were defined before PROJ 6 provided full EPSG support. --- .../java/org/apache/sis/metadata/iso/citation/Citations.java | 7 +++++-- .../java/org/apache/sis/metadata/sql/MetadataFallback.java | 10 +++++----- .../main/resources/org/apache/sis/metadata/sql/Citations.sql | 6 +++--- .../org/apache/sis/metadata/iso/citation/CitationsTest.java | 2 +- .../java/org/apache/sis/metadata/sql/MetadataSourceTest.java | 2 +- .../referencing/operation/projection/NormalizedProjection.java | 4 ++-- .../referencing/operation/projection/TransverseMercator.java | 2 +- .../sis/referencing/operation/projection/package-info.java | 3 ++- .../referencing/operation/projection/AlbersEqualAreaTest.java | 4 ++-- .../operation/projection/CylindricalEqualAreaTest.java | 2 +- .../sis/referencing/operation/projection/SinusoidalTest.java | 4 ++-- .../sis/referencing/report/CoordinateReferenceSystems.java | 4 +++- .../java/org/apache/sis/test/integration/ConsistencyTest.java | 4 +++- .../src/main/java/org/apache/sis/internal/util/Constants.java | 2 ++ 14 files changed, 33 insertions(+), 23 deletions(-) diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java index c3a74c6c72..1a8f066afe 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/iso/citation/Citations.java @@ -351,7 +351,10 @@ public final class Citations extends Static { public static final IdentifierSpace<Integer> GEOTIFF = new CitationConstant.Authority<>(Constants.GEOTIFF); /** - * The authority for identifiers of objects defined by the <a href="https://proj4.org/">Proj.4</a> project. + * The authority for identifiers of objects defined by the <a href="https://proj.org/">PROJ</a> project. + * We use the {@code PROJ4} name for historical reasons, because those identifiers were defined mostly + * when the project was known as "Proj.4". Starting at PROJ version 6, EPSG identifiers should be used + * instead. * * <h4>Main usage</h4> * This value can be returned by: @@ -361,7 +364,7 @@ public final class Citations extends Static { * * @since 0.4 */ - public static final IdentifierSpace<String> PROJ4 = new CitationConstant.Authority<>(Constants.PROJ4); + public static final IdentifierSpace<String> PROJ4 = new CitationConstant.Authority<>("PROJ", Constants.PROJ4); /** * The authority for identifiers of objects defined by MapInfo. diff --git a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java index b094e70a31..4f7a6f2f3e 100644 --- a/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java +++ b/core/sis-metadata/src/main/java/org/apache/sis/metadata/sql/MetadataFallback.java @@ -156,8 +156,8 @@ final class MetadataFallback extends MetadataSource { presentationForm = PresentationForm.DOCUMENT_DIGITAL; break; } - case "IOGP": { // Not in public API (see Citations.IOGP javadoc) - title = "IOGP Surveying and Positioning Guidance Note 7"; + case "IOGP": { // Not in public API (see Citations.IOGP javadoc) + title = "IOGP Surveying and Positioning Guidance Note 7"; code = Constants.IOGP; copyFrom = Constants.EPSG; presentationForm = PresentationForm.DOCUMENT_DIGITAL; @@ -188,9 +188,9 @@ final class MetadataFallback extends MetadataSource { alternateTitle = key; break; } - case Constants.PROJ4: { - title = "Proj"; - code = "Proj4"; + case "PROJ": { + title = "PROJ coordinate transformation software library"; + code = "PROJ"; codeSpace = "OSGeo"; break; } diff --git a/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Citations.sql b/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Citations.sql index 392881ce98..69a3fc4cce 100644 --- a/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Citations.sql +++ b/core/sis-metadata/src/main/resources/org/apache/sis/metadata/sql/Citations.sql @@ -48,7 +48,7 @@ INSERT INTO metadata."OnlineResource" ("ID", "linkage") VALUES ('Oracle', 'https://www.oracle.com/'), ('OSGeo', 'https://www.osgeo.org/'), ('PostGIS', 'https://postgis.net/'), - ('Proj4', 'https://proj4.org/'), + ('PROJ', 'https://proj.org/'), ('SIS', 'https://sis.apache.org/'), ('WMO', 'https://www.wmo.int/'), ('WMS', 'https://www.ogc.org/standards/wms'); @@ -192,7 +192,7 @@ INSERT INTO metadata."Identifier" ("ID", "code", "codeSpace", "version") VALUES ('EPSG', 'EPSG', 'IOGP', NULL), ('ArcGIS', 'ArcGIS', 'ESRI', NULL), ('MapInfo', 'MapInfo', 'Pitney Bowes', NULL), - ('Proj4', 'Proj4', 'OSGeo', NULL), + ('PROJ', 'PROJ', 'OSGeo', NULL), ('SIS', 'SIS', 'Apache', NULL); INSERT INTO metadata."Citation" ("ID", "onlineResource", "edition", "citedResponsibleParty", "presentationForm", "alternateTitle" , "title") VALUES @@ -206,7 +206,7 @@ INSERT INTO metadata."Citation" ("ID", "onlineResource", "edition", "citedRespon ('EPSG', 'EPSG', NULL, 'IOGP', 'tableDigital', 'EPSG Dataset', 'EPSG Geodetic Parameter Dataset'), ('ArcGIS', 'ESRI', NULL, 'ESRI', NULL, NULL, 'ArcGIS'), ('MapInfo', NULL, NULL, 'MapInfo', NULL, 'MapInfo', 'MapInfo Pro'), - ('Proj4', 'Proj4', NULL, 'OSGeo', NULL, 'Proj', 'PROJ coordinate transformation software library'), + ('PROJ', 'PROJ', NULL, 'OSGeo', NULL, 'Proj', 'PROJ coordinate transformation software library'), ('SIS', 'SIS', NULL, 'Apache', NULL, 'Apache SIS', 'Apache Spatial Information System'); diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java index 513862c6e2..aa1b2df284 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/iso/citation/CitationsTest.java @@ -130,7 +130,7 @@ public final strictfp class CitationsTest extends TestCase { assertEquals("Pitney Bowes:MapInfo", getIdentifier(MAP_INFO)); assertEquals("ISBN", getIdentifier(ISBN)); assertEquals("ISSN", getIdentifier(ISSN)); - assertEquals("OSGeo:Proj4", getIdentifier(PROJ4)); // Not a valid Unicode identifier. + assertEquals("OSGeo:PROJ", getIdentifier(PROJ4)); // Not a valid Unicode identifier. assertEquals("IHO:S-57", getIdentifier(S57)); // Not a valid Unicode identifier. assertEquals("ISO:19115-1", getIdentifier(ISO_19115.get(0))); // The ':' separator is not usual in ISO references assertEquals("ISO:19115-2", getIdentifier(ISO_19115.get(1))); // and could be changed in future SIS versions. diff --git a/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java b/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java index 2e6a3cc0f2..55c19f49cb 100644 --- a/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java +++ b/core/sis-metadata/src/test/java/org/apache/sis/metadata/sql/MetadataSourceTest.java @@ -39,7 +39,7 @@ import static org.apache.sis.test.TestUtilities.getSingleton; * Tests {@link MetadataSource}. * * @author Martin Desruisseaux (Geomatys) - * @version 1.0 + * @version 1.3 * @since 0.8 * @module */ diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java index cbb7874eb3..f8582c5bae 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java @@ -711,7 +711,7 @@ public abstract class NormalizedProjection extends AbstractMathTransform2D imple * concatenated transform that include the <cite>normalization</cite> and <cite>denormalization</cite> * matrices documented in this class javadoc.</div> * - * <div class="note"><b>Note 2:</b> in <a href="https://proj4.org/">Proj.4</a>, the same standardization, + * <div class="note"><b>Note 2:</b> in the <a href="https://proj.org/">PROJ</a> library, the same standardization, * described above, is handled by {@code pj_fwd.c}, except for the projection-specific additional factors.</div> * * <h4>Argument checks</h4> @@ -749,7 +749,7 @@ public abstract class NormalizedProjection extends AbstractMathTransform2D imple * or ellipse having a semi-major axis of 1. * Additional projection-specific factors may also need to be applied (see class javadoc). * - * <div class="note"><b>Note:</b> in <a href="https://proj4.org/">Proj.4</a>, the same standardization, + * <div class="note"><b>Note:</b> in the <a href="https://proj.org/">PROJ</a> library, the same standardization, * described above, is handled by {@code pj_inv.c}, except for the projection-specific additional factors.</div> * * @param srcPts the array containing the source point coordinate, as linear distance on a unit sphere or ellipse. diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java index 478cc86683..9b95cacf96 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/TransverseMercator.java @@ -765,7 +765,7 @@ public class TransverseMercator extends NormalizedProjection { final double tanφ = sinφ / cosφ; final double B = cosφ * sinλ; /* - * Using Snyder's equation for calculating y, instead of the one used in Proj.4. + * Using Snyder's equation for calculating y, instead of the one used in PROJ. * Potential problems when y and x = 90 degrees, but behaves ok in tests. */ if (dstPts != null) { diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java index 0bf3eec923..f2ad34531e 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/package-info.java @@ -143,7 +143,8 @@ * above-cited normalization and denormalization affine transforms.</p> * * <div class="note"><b>Note:</b> - * In <a href="http://proj4.org/">Proj.4</a>, the same standardization is handled by {@code pj_fwd.c} and {@code pj_inv.c}. + * In the <a href="https://proj.org/">PROJ</a> library, + * the same standardization is handled by {@code pj_fwd.c} and {@code pj_inv.c}. * This normalization makes the equations closer to the ones published in Snyder's book, where the * <cite>false easting</cite>, <cite>false northing</cite> and <cite>scale factor</cite> are usually not given.</div> * diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java index 5ca8775202..9c388547f9 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/AlbersEqualAreaTest.java @@ -155,14 +155,14 @@ public final strictfp class AlbersEqualAreaTest extends MapProjectionTestCase { } /** - * Uses Proj.4 test point has a reference. + * Uses test point from PROJ library as a reference. * * @throws FactoryException if an error occurred while creating the map projection. * @throws TransformException if an error occurred while projecting a point. */ @Test @DependsOnMethod("testEllipse") - public void compareWithProj4() throws FactoryException, TransformException { + public void compareWithPROJ() throws FactoryException, TransformException { toleranceModifier = ToleranceModifier.PROJECTION; tolerance = Formulas.LINEAR_TOLERANCE; diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java index 9753e0a44c..9d34fc0528 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/CylindricalEqualAreaTest.java @@ -75,7 +75,7 @@ public final strictfp class CylindricalEqualAreaTest extends MapProjectionTestCa toleranceModifier = ToleranceModifier.PROJECTION; final double λ = 2; final double φ = 1; - final double x = 222638.98; // Test point from Proj.4. + final double x = 222638.98; // Test point from PROJ library. final double y = 110568.81; verifyTransform(new double[] {λ, φ, -λ, φ, λ, -φ, -λ, -φ}, new double[] {x, y, -x, y, x, -y, -x, -y}); diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/SinusoidalTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/SinusoidalTest.java index 743e844e5b..6ede75e1b7 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/SinusoidalTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/SinusoidalTest.java @@ -67,7 +67,7 @@ public final strictfp class SinusoidalTest extends MapProjectionTestCase { }, new double[] { // Expected (x,y) results in metres. 1077000.98, -5585053.61, // Values derived from Snyder page 365. - 223368.12, 111701.07 // Values taken from PROJ.4. + 223368.12, 111701.07 // Values taken from PROJ library. }); } @@ -89,7 +89,7 @@ public final strictfp class SinusoidalTest extends MapProjectionTestCase { }, new double[] { // Expected (x,y) results in metres. 1075471.54, -5540628.03, // Values from Snyder page 366. - 222607.72, 110567.32 // Values taken from PROJ.4 and modified for Clarke 1866. + 222607.72, 110567.32 // Values taken from PROJ and modified for Clarke 1866. }); } diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java index 1c01f792c6..d24443bdcd 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/report/CoordinateReferenceSystems.java @@ -47,11 +47,13 @@ import org.opengis.referencing.operation.OperationMethod; import org.opengis.test.report.AuthorityCodesReport; import org.apache.sis.metadata.iso.citation.Citations; import org.apache.sis.internal.referencing.DeprecatedCode; +import org.apache.sis.internal.util.Constants; import org.apache.sis.referencing.CRS; import org.apache.sis.referencing.CommonCRS; import org.apache.sis.referencing.IdentifiedObjects; import org.apache.sis.referencing.crs.AbstractCRS; import org.apache.sis.referencing.cs.AxesConvention; +import org.apache.sis.util.iso.DefaultNameSpace; import org.apache.sis.util.logging.Logging; import org.apache.sis.util.CharSequences; import org.apache.sis.util.ComparisonMode; @@ -580,7 +582,7 @@ public final strictfp class CoordinateReferenceSystems extends AuthorityCodesRep */ @Override protected Row createRow(final String code, final FactoryException exception) { - if (code.startsWith("Proj4:")) { + if (code.startsWith(Constants.PROJ4 + DefaultNameSpace.DEFAULT_SEPARATOR)) { return null; } final Row row = super.createRow(code, exception); diff --git a/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java b/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java index 614da83860..fab5bee949 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/test/integration/ConsistencyTest.java @@ -31,11 +31,13 @@ import org.apache.sis.referencing.factory.FactoryDataException; import org.apache.sis.referencing.factory.UnavailableFactoryException; import org.apache.sis.referencing.IdentifiedObjects; import org.apache.sis.referencing.CRS; +import org.apache.sis.internal.util.Constants; import org.apache.sis.io.wkt.Convention; import org.apache.sis.io.wkt.Warnings; import org.apache.sis.io.wkt.WKTFormat; import org.apache.sis.io.TableAppender; import org.apache.sis.io.wkt.UnformattableObjectException; +import org.apache.sis.util.iso.DefaultNameSpace; import org.apache.sis.util.ComparisonMode; import org.apache.sis.util.CharSequences; import org.apache.sis.util.Utilities; @@ -121,7 +123,7 @@ public final strictfp class ConsistencyTest extends TestCase { v2 .setConvention(Convention.WKT2); v2s.setConvention(Convention.WKT2_SIMPLIFIED); for (final String code : CRS.getAuthorityFactory(null).getAuthorityCodes(CoordinateReferenceSystem.class)) { - if (!EXCLUDES.contains(code) && !code.startsWith("Proj4:")) { + if (!EXCLUDES.contains(code) && !code.startsWith(Constants.PROJ4 + DefaultNameSpace.DEFAULT_SEPARATOR)) { final CoordinateReferenceSystem crs; try { crs = CRS.forCode(code); diff --git a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java index 8dc4e61747..1d9de64c96 100644 --- a/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java +++ b/core/sis-utility/src/main/java/org/apache/sis/internal/util/Constants.java @@ -91,6 +91,8 @@ public final class Constants extends Static { /** * The {@value} code space. The project name is {@code "Proj.4"}, but this constant omits * the dot because this name is used as a code space and we want to avoid risk of confusion. + * We use "Proj4" instead of "PROJ" for historical reasons, because we use this identifier + * for parameters defined by old PROJ versions, before PROJ 6 introduced full support of EPSG names. */ public static final String PROJ4 = "Proj4";
