This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-3.1 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 14ecaa65576268b7ff380292a2426a1790873286 Merge: 11f6114609 38a53c45ac Author: Martin Desruisseaux <[email protected]> AuthorDate: Thu Sep 11 12:44:46 2025 +0200 Merge branch 'geoapi-4.0' into geoapi-3.1. Contains bug fixes. .../apache/sis/console/FormattedOutputCommand.java | 2 +- .../org/apache/sis/console/TransformCommand.java | 4 +- .../org/apache/sis/console/CRSCommandTest.java | 13 + .../sis/coverage/grid/ClippedGridCoverageTest.java | 2 +- .../org/apache/sis/xml/bind/lan/PT_FreeText.java | 2 +- .../sis/metadata/xml/SchemaComplianceTest.java | 4 +- .../sis/openoffice/ReferencingFunctions.java | 14 +- .../sis/openoffice/ReferencingFunctionsTest.java | 8 +- .../apache/sis/io/wkt/GeodeticObjectParser.java | 176 +++++++++----- .../referencing/datum/DefaultDatumEnsemble.java | 15 ++ .../referencing/factory/AuthorityFactoryProxy.java | 33 ++- .../factory/ConcurrentAuthorityFactory.java | 5 +- .../factory/MultiAuthoritiesFactory.java | 2 +- .../referencing/factory/sql/EPSGDataAccess.java | 12 +- .../operation/AbstractCoordinateOperation.java | 58 ++--- .../operation/DefaultConcatenatedOperation.java | 43 +++- .../DefaultCoordinateOperationFactory.java | 40 ++- .../referencing/operation/projection/Mercator.java | 11 +- .../operation/provider/AbstractLambert.java | 2 + .../operation/provider/AbstractMercator.java | 2 + .../operation/provider/AbstractStereographic.java | 2 + .../operation/provider/AxisOrderReversal.java | 4 +- .../operation/provider/AxisOrderReversal3D.java | 4 +- .../operation/provider/CassiniSoldner.java | 4 + .../operation/provider/Equirectangular.java | 10 +- .../provider/FranceGeocentricInterpolation.java | 6 +- .../operation/provider/GeocentricAffine.java | 31 ++- .../operation/provider/GeocentricTranslation.java | 1 + .../provider/GeographicAndVerticalOffsets.java | 5 +- .../operation/provider/GeographicOffsets.java | 3 +- .../provider/LambertAzimuthalEqualArea.java | 4 + .../operation/provider/LambertConformal1SP.java | 3 + .../operation/provider/LambertConformal2SP.java | 8 +- .../provider/LambertConformalMichigan.java | 4 +- .../operation/provider/LambertConformalWest.java | 1 + .../provider/LambertCylindricalEqualArea.java | 4 + .../operation/provider/MapProjection.java | 16 +- .../operation/provider/Mercator1SP.java | 2 + .../provider/ModifiedAzimuthalEquidistant.java | 4 + .../referencing/operation/provider/Mollweide.java | 2 +- .../operation/provider/ObliqueMercator.java | 2 + .../operation/provider/ObliqueStereographic.java | 2 + .../operation/provider/Orthographic.java | 4 + .../operation/provider/PolarStereographicA.java | 2 + .../referencing/operation/provider/Polyconic.java | 4 + .../operation/provider/RegionalMercator.java | 36 ++- .../operation/provider/TransverseMercator.java | 2 + .../provider/ZonedTransverseMercator.java | 2 + .../apache/sis/referencing/privy/WKTKeywords.java | 267 ++++++++------------- .../sis/io/wkt/GeodeticObjectParserTest.java | 7 +- .../org/apache/sis/referencing/Assertions.java | 67 +----- .../org/apache/sis/referencing/CommonCRSTest.java | 2 +- .../sis/referencing/GeodeticObjectVerifier.java | 10 +- .../referencing/factory/sql/EPSGFactoryTest.java | 9 +- .../DefaultConcatenatedOperationTest.java | 75 +++++- .../operation/DefaultTransformationTest.java | 3 +- .../referencing/operation/PassThroughOperation.xml | 4 +- .../provider/ParameterNameTableGenerator.java | 18 +- .../operation/provider/ProvidersTest.java | 121 +++++++++- .../report/CoordinateReferenceSystems.java | 4 +- .../sis/test/integration/ConsistencyTest.java | 41 +--- .../main/org/apache/sis/storage/base/CodeType.java | 25 +- .../test/org/apache/sis/test/Assertions.java | 13 +- .../org/apache/sis/test/ProjectDirectories.java | 79 ++---- 64 files changed, 818 insertions(+), 547 deletions(-) diff --cc endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java index f94b1178b6,c5337d7ae0..e9a7a679a5 --- a/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java +++ b/endorsed/src/org.apache.sis.openoffice/main/org/apache/sis/openoffice/ReferencingFunctions.java @@@ -28,6 -28,6 +28,7 @@@ import org.opengis.referencing.Identifi import org.opengis.referencing.ReferenceSystem; import org.opengis.referencing.cs.CoordinateSystem; import org.opengis.referencing.cs.CoordinateSystemAxis; ++import org.opengis.referencing.crs.CRSAuthorityFactory; import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.apache.sis.metadata.iso.extent.Extents; import org.apache.sis.referencing.CRS; @@@ -121,8 -124,13 +122,9 @@@ public class ReferencingFunctions exten type = CodeType.guess(codeOrPath); } if (type.equals(CodeType.URN)) { - object = CRS.getAuthorityFactory(null).createObject(codeOrPath); - } else if (type.isCRS) { + CRSAuthorityFactory factory = CRS.getAuthorityFactory(null); - if (factory instanceof GeodeticAuthorityFactory) { - object = ((GeodeticAuthorityFactory) factory).createObject(codeOrPath); - } else { - object = factory.createCoordinateReferenceSystem(codeOrPath); - } ++ object = factory.createObject(codeOrPath); + } else if (type.isAuthorityCode) { object = CRS.forCode(codeOrPath); } else { /* diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java index 94eb593acc,a712ecbbfa..930c73cec9 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java @@@ -88,12 -89,14 +89,13 @@@ import org.apache.sis.util.privy.String import org.apache.sis.util.resources.Errors; import org.apache.sis.util.iso.Types; +// Specific to the main and geoapi-3.1 branches: +import org.opengis.referencing.ReferenceIdentifier; + // Specific to the geoapi-3.1 and geoapi-4.0 branches: + import org.opengis.coordinate.CoordinateMetadata; import org.opengis.referencing.ObjectDomain; -// Specific to the geoapi-4.0 branch: -import org.apache.sis.referencing.crs.DefaultImageCRS; -import org.apache.sis.referencing.datum.DefaultImageDatum; - /** * Well Known Text (WKT) parser for referencing objects. This include, but is not limited too, @@@ -1481,9 -1525,9 +1524,9 @@@ class GeodeticObjectParser extends Math if (ellipsoid != null) { // `memberType` may be `Datum` or `GeodeticDatum` member = datumFactory.createGeodeticDatum(properties, ellipsoid, meridian); } else if (vertical) { - member = datumFactory.createVerticalDatum(properties, (RealizationMethod) null); + member = datumFactory.createVerticalDatum(properties, VerticalDatumTypes.fromDatum(name, null, null)); } else if (datumType == TemporalDatum.class) { - member = datumFactory.createTemporalDatum(properties, null); + member = datumFactory.createTemporalDatum(properties, (Temporal) null); } else if (datumType == ParametricDatum.class) { member = datumFactory.createParametricDatum(properties); } else if (datumType == EngineeringDatum.class) { diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java index d6810f8665,a18d39d05b..ce15c98e42 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/factory/sql/EPSGDataAccess.java @@@ -1707,18 -1706,12 +1707,12 @@@ search: try (ResultSet result = execute final boolean old = !deprecated || Semaphores.queryAndSet(Semaphores.SUSPEND_PARAMETER_CHECK); try { /* - * For a ProjectedCRS, the baseCRS is always geodetic. So in theory we would not - * need the `instanceof` check. However, the EPSG dataset version 8.9 also uses the - * "projected" type for CRS that are actually derived CRS. See EPSG:5820 and 5821. - * - * TODO: there is an ambiguity when the source CRS is geographic but the operation - * is nevertheless considered as not a map projection. It is the case of EPSG:5819. - * The problem is that the "COORD_REF_SYS_KIND" column still contains "Projected". - * We need to check if EPSG database 10+ has more specific information. - * See https://issues.apache.org/jira/browse/SIS-518 + * For a ProjectedCRS, the baseCRS is usually geodetic. However, geocentric CRS + * is also allowed, but not yet supported in the code below. We could also have + * a ProjectedCRS derived from another ProjectedCRS. */ - if (baseCRS instanceof GeodeticCRS) { - return factory.createProjectedCRS(metadata, (GeodeticCRS) baseCRS, fromBase, cs); + if (baseCRS instanceof GeographicCRS) { + return factory.createProjectedCRS(metadata, (GeographicCRS) baseCRS, fromBase, cs); } else { return factory.createDerivedCRS(metadata, baseCRS, fromBase, cs); } diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java index f5ddb6ab61,d168be5067..38bf9d25ba --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/AbstractCoordinateOperation.java @@@ -957,6 -953,18 +957,19 @@@ check: for (int isTarget=0; ; isTa @Override protected String formatTo(final Formatter formatter) { super.formatTo(formatter); + final Convention convention = formatter.getConvention(); + final boolean isWKT1 = (convention.majorVersion() == 1); + if (convention.supports(Convention.WKT2_2019)) { - getOperationVersion().ifPresent((version) -> { ++ String version = getOperationVersion(); ++ if (version != null) { + formatter.append(new FormattableObject() { + @Override protected String formatTo(final Formatter formatter) { + formatter.append(version, null); + return WKTKeywords.Version; + } + }); - }); ++ }; + } formatter.newLine(); @SuppressWarnings("LocalVariableHidesMemberVariable") final CoordinateReferenceSystem sourceCRS = getSourceCRS(), diff --cc endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java index 656e9113cf,57917b27c6..73218601cf --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/DefaultConcatenatedOperation.java @@@ -47,11 -49,10 +49,13 @@@ import org.apache.sis.util.collection.C import org.apache.sis.util.privy.UnmodifiableArrayList; import org.apache.sis.util.privy.Constants; import org.apache.sis.util.resources.Errors; + import org.apache.sis.io.wkt.Convention; + import org.apache.sis.io.wkt.FormattableObject; import org.apache.sis.io.wkt.Formatter; +// Specific to the main and geoapi-3.1 branches: +import org.opengis.referencing.operation.SingleOperation; + /** * An ordered sequence of two or more single coordinate operations. The sequence of operations is constrained
