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: Remove ReferencingUtilities method that require a factory. Replaced by methods in ReferencingFactoryContainer or GeodeticObjectBuilder.
Date Wed, 29 May 2019 10:47:12 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 71e6d55  Remove ReferencingUtilities method that require a factory. Replaced by methods
in ReferencingFactoryContainer or GeodeticObjectBuilder.
71e6d55 is described below

commit 71e6d556340e91baac96ac29b554bb8a98c553a7
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed May 29 12:32:40 2019 +0200

    Remove ReferencingUtilities method that require a factory. Replaced by methods in ReferencingFactoryContainer
or GeodeticObjectBuilder.
---
 .../referencing/GeodeticObjectBuilder.java         | 37 +++++++-
 .../referencing/ReferencingFactoryContainer.java   | 14 +++
 .../internal/referencing/ReferencingUtilities.java | 44 ----------
 .../storage/earthobservation/LandsatReader.java    | 99 +++++++++++-----------
 .../org/apache/sis/storage/geotiff/CRSBuilder.java |  2 +-
 .../org/apache/sis/internal/netcdf/CRSBuilder.java |  3 +-
 .../apache/sis/internal/netcdf/GridMapping.java    |  3 +-
 7 files changed, 99 insertions(+), 103 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
index 3bdf76a..24eca3f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/GeodeticObjectBuilder.java
@@ -19,6 +19,7 @@ package org.apache.sis.internal.referencing;
 import java.util.Map;
 import java.util.Date;
 import java.util.Collections;
+import java.util.Locale;
 import javax.measure.Unit;
 import javax.measure.quantity.Time;
 import javax.measure.quantity.Length;
@@ -96,10 +97,25 @@ public class GeodeticObjectBuilder extends Builder<GeodeticObjectBuilder>
{
     private final ReferencingFactoryContainer factories;
 
     /**
+     * The locale for error messages, or {@code null} for default locale.
+     */
+    private final Locale locale;
+
+    /**
      * Creates a new builder.
      */
     public GeodeticObjectBuilder() {
+        this(null);
+    }
+
+    /**
+     * Creates a new builder using the given locale for message in exceptions.
+     *
+     * @param  locale  the locale for error message in exceptions.
+     */
+    public GeodeticObjectBuilder(final Locale locale) {
         factories = new ReferencingFactoryContainer();
+        this.locale = locale;
     }
 
     /**
@@ -175,7 +191,7 @@ public class GeodeticObjectBuilder extends Builder<GeodeticObjectBuilder>
{
      */
     public GeodeticObjectBuilder setConversionMethod(final String name) throws FactoryException
{
         if (method != null) {
-            throw new IllegalStateException(Errors.format(Errors.Keys.ElementAlreadyPresent_1,
"OperationMethod"));
+            throw new IllegalStateException(Errors.getResources(locale).getString(Errors.Keys.ElementAlreadyPresent_1,
"OperationMethod"));
         }
         method = factories.getCoordinateOperationFactory().getOperationMethod(name);
         parameters = method.getParameters().createValue();
@@ -195,11 +211,26 @@ public class GeodeticObjectBuilder extends Builder<GeodeticObjectBuilder>
{
     }
 
     /**
+     * Sets the conversion method together with all parameters. This method does not set
the conversion name.
+     * If a name different than the default is desired, {@link #setConversionName(String)}
should be invoked.
+     *
+     * @param  parameters  the map projection parameter values.
+     * @return {@code this}, for method calls chaining.
+     * @throws FactoryException if the operation method can not be obtained.
+     */
+    public GeodeticObjectBuilder setConversion(final ParameterValueGroup parameters) throws
FactoryException {
+        ArgumentChecks.ensureNonNull("parameters", parameters);
+        method = factories.getCoordinateOperationFactory().getOperationMethod(parameters.getDescriptor().getName().getCode());
+        this.parameters = parameters;           // Set only if above line succeed.
+        return this;
+    }
+
+    /**
      * Ensures that {@link #setConversionMethod(String)} has been invoked.
      */
     private void ensureConversionMethodSet() {
         if (parameters == null) {
-            throw new IllegalStateException();  // TODO: provide an error message.
+            throw new IllegalStateException(Resources.forLocale(locale).getString(Resources.Keys.UnspecifiedParameterValues));
         }
     }
 
@@ -368,7 +399,7 @@ public class GeodeticObjectBuilder extends Builder<GeodeticObjectBuilder>
{
         if (datum != null) {
             crs = factories.getCRSFactory().createGeographicCRS(name(datum), datum, crs.getCoordinateSystem());
         }
-        return createProjectedCRS(crs, ReferencingUtilities.standardProjectedCS(factories.getCSAuthorityFactory()));
+        return createProjectedCRS(crs, factories.getStandardProjectedCS());
     }
 
     /**
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
index 10144fc..7cd98bd 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingFactoryContainer.java
@@ -17,6 +17,7 @@
 package org.apache.sis.internal.referencing;
 
 import org.opengis.util.FactoryException;
+import org.opengis.referencing.cs.CartesianCS;
 import org.opengis.referencing.cs.CSFactory;
 import org.opengis.referencing.cs.CSAuthorityFactory;
 import org.opengis.referencing.crs.CRSFactory;
@@ -34,6 +35,8 @@ import org.apache.sis.referencing.CRS;
 
 /**
  * A container of factories frequently used together.
+ * Provides also some utility methods working with factories.
+ *
  * This class may be temporary until we choose a dependency injection framework
  * See <a href="https://issues.apache.org/jira/browse/SIS-102">SIS-102</a>.
  *
@@ -210,4 +213,15 @@ public class ReferencingFactoryContainer {
         }
         return mtFactory;
     }
+
+    /**
+     * Returns the a coordinate system for map projections with (easting, northing) axes
in metres.
+     * EPSG::4400 — Cartesian 2D CS. Axes: easting, northing (E,N). Orientations: east,
north. UoM: m.
+     *
+     * @return a coordinate system with (easting, northing) axes in metres.
+     * @throws FactoryException if an error occurred while creating the coordinate system.
+     */
+    public final CartesianCS getStandardProjectedCS() throws FactoryException {
+        return getCSAuthorityFactory().createCartesianCS("4400");
+    }
 }
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
index 664920d..667426f 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/ReferencingUtilities.java
@@ -25,7 +25,6 @@ import org.opengis.annotation.UML;
 import org.opengis.annotation.Specification;
 import org.opengis.metadata.Identifier;
 import org.opengis.metadata.citation.Citation;
-import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.parameter.ParameterDescriptorGroup;
 import org.opengis.parameter.GeneralParameterDescriptor;
 import org.opengis.referencing.cs.*;
@@ -37,9 +36,6 @@ import org.opengis.referencing.datum.PrimeMeridian;
 import org.opengis.referencing.datum.GeodeticDatum;
 import org.opengis.referencing.datum.VerticalDatum;
 import org.opengis.referencing.datum.VerticalDatumType;
-import org.opengis.referencing.operation.CoordinateOperationFactory;
-import org.opengis.util.FactoryException;
-import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.util.Static;
 import org.apache.sis.util.Utilities;
 import org.apache.sis.util.CharSequences;
@@ -491,46 +487,6 @@ public final class ReferencingUtilities extends Static {
     }
 
     /**
-     * Creates a projected CRS from the given parameters using the default factories.
-     *
-     * @param  properties   the name and other properties, to be given both to the conversion
and the CRS.
-     * @param  baseCRS      the base geographic CRS.
-     * @param  parameters   the map projection parameters.
-     * @param  cs           the projected coordinate system.
-     * @return the projected coordinate reference system.
-     * @throws FactoryException if an error occurred while creating the CRS.
-     *
-     * @since 0.8
-     */
-    public static ProjectedCRS createProjectedCRS(final Map<String,String> properties,
-            final GeographicCRS baseCRS, final ParameterValueGroup parameters, final CartesianCS
cs)
-            throws FactoryException
-    {
-        final CoordinateOperationFactory factory = DefaultFactories.forBuildin(CoordinateOperationFactory.class);
-        return DefaultFactories.forBuildin(CRSFactory.class).createProjectedCRS(properties,
baseCRS,
-                factory.createDefiningConversion(properties,
-                        factory.getOperationMethod(parameters.getDescriptor().getName().getCode()),
parameters), cs);
-    }
-
-    /**
-     * Returns the a coordinate system for map projections with (easting, northing) axes
in metres.
-     * EPSG::4400 — Cartesian 2D CS. Axes: easting, northing (E,N). Orientations: east,
north. UoM: m.
-     *
-     * @param  factory the EPSG factory to use for creating the coordinate system.
-     * @return a coordinate system with (easting, northing) axes in metres.
-     * @throws FactoryException if an error occurred while creating the coordinate system.
-     *
-     * @since 1.0
-     */
-    public static CartesianCS standardProjectedCS(final CSAuthorityFactory factory) throws
FactoryException {
-        /*
-         * Note: we may provide a default factory in a future SIS version.
-         * We may need to mimic ReferencingFactoryContainer.getCSAuthorityFactory().
-         */
-        return factory.createCartesianCS("4400");
-    }
-
-    /**
      * Returns the mapping between parameter identifiers and parameter names as defined by
the given authority.
      * This method assumes that the identifiers of all parameters defined by that authority
are numeric.
      * Examples of authorities defining numeric parameters are EPSG and GeoTIFF.
diff --git a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
index 79170f9..31dc007 100644
--- a/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
+++ b/storage/sis-earth-observation/src/main/java/org/apache/sis/storage/earthobservation/LandsatReader.java
@@ -19,7 +19,6 @@ package org.apache.sis.storage.earthobservation;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.Date;
 import java.util.Locale;
 import java.util.regex.Matcher;
@@ -40,7 +39,6 @@ import org.opengis.metadata.content.TransferFunctionType;
 import org.opengis.metadata.maintenance.ScopeCode;
 import org.opengis.parameter.ParameterValueGroup;
 import org.opengis.referencing.crs.ProjectedCRS;
-import org.opengis.referencing.operation.MathTransformFactory;
 import org.opengis.util.NoSuchIdentifierException;
 import org.opengis.util.FactoryException;
 
@@ -62,11 +60,11 @@ import org.apache.sis.util.resources.Errors;
 import org.apache.sis.util.resources.Vocabulary;
 import org.apache.sis.util.logging.WarningListeners;
 import org.apache.sis.util.iso.SimpleInternationalString;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
+import org.apache.sis.internal.referencing.GeodeticObjectBuilder;
+import org.apache.sis.internal.referencing.ReferencingFactoryContainer;
 import org.apache.sis.internal.referencing.provider.PolarStereographicB;
 import org.apache.sis.internal.referencing.provider.TransverseMercator;
 import org.apache.sis.internal.storage.MetadataBuilder;
-import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.StandardDateFormat;
 import org.apache.sis.internal.util.Constants;
 import org.apache.sis.internal.util.Strings;
@@ -102,7 +100,7 @@ import static org.apache.sis.internal.util.CollectionsExt.singletonOrNull;
  * @since   0.8
  * @module
  */
-final class LandsatReader {
+final class LandsatReader extends MetadataBuilder {
     /**
      * Names of Landsat bands.
      *
@@ -213,11 +211,6 @@ final class LandsatReader {
     private String filename;
 
     /**
-     * Helper class for building the ISO 19115 metadata instance.
-     */
-    private final MetadataBuilder metadata;
-
-    /**
      * Where to send the warnings.
      */
     private final WarningListeners<DataStore> listeners;
@@ -291,6 +284,11 @@ final class LandsatReader {
     private ParameterValueGroup projection;
 
     /**
+     * The referencing objects factories.
+     */
+    private final ReferencingFactoryContainer factories;
+
+    /**
      * Creates a new metadata parser.
      *
      * @param  filename   an identifier of the file being read, or {@code null} if unknown.
@@ -299,7 +297,7 @@ final class LandsatReader {
     LandsatReader(final String filename, final WarningListeners<DataStore> listeners)
{
         this.filename  = filename;
         this.listeners = listeners;
-        this.metadata  = new MetadataBuilder();
+        this.factories = new ReferencingFactoryContainer();
         this.bands     = new DefaultBand[BAND_NAMES.length];
         this.gridSizes = new int[NUM_GROUPS * DIM];
         this.corners   = new double[GEOGRAPHIC + (4*DIM)];      // GEOGRAPHIC is the last
group of corners to store.
@@ -317,7 +315,7 @@ final class LandsatReader {
      * @throws DataStoreException if the content is not a Landsat file.
      */
     void read(final BufferedReader reader) throws IOException, DataStoreException {
-        metadata.newCoverage(true);   // Starts the description of a new image.
+        newCoverage(true);              // Starts the description of a new image.
         String line;
         while ((line = reader.readLine()) != null) {
             int end  = CharSequences.skipTrailingWhitespaces(line, 0, line.length());
@@ -386,7 +384,7 @@ final class LandsatReader {
      * @throws  NumberFormatException if the given value can not be parsed.
      */
     private Double parseDouble(final String value) throws NumberFormatException {
-        return metadata.shared(Double.valueOf(value));
+        return shared(Double.valueOf(value));
     }
 
     /**
@@ -445,10 +443,10 @@ final class LandsatReader {
             case "ORIGIN": {
                 final Matcher m = CREDIT.matcher(value);
                 if (m.find()) {
-                    metadata.newParty(MetadataBuilder.PartyType.ORGANISATION);
-                    metadata.addAuthor(value.substring(m.end()));
+                    newParty(MetadataBuilder.PartyType.ORGANISATION);
+                    addAuthor(value.substring(m.end()));
                 }
-                metadata.addCredits(value);
+                addCredits(value);
                 break;
             }
             /*
@@ -457,7 +455,7 @@ final class LandsatReader {
              * Example: "0501403126384_00011"
              */
             case "REQUEST_ID": {
-                metadata.addAcquisitionRequirement(null, value);
+                addAcquisitionRequirement(null, value);
                 break;
             }
             /*
@@ -466,7 +464,7 @@ final class LandsatReader {
              * Example: "LC81230522014071LGN00".
              */
             case "LANDSAT_SCENE_ID": {
-                metadata.addTitleOrIdentifier(value, MetadataBuilder.Scope.ALL);
+                addTitleOrIdentifier(value, MetadataBuilder.Scope.ALL);
                 break;
             }
             /*
@@ -476,8 +474,8 @@ final class LandsatReader {
              * Example: "2014-03-12T06:06:35Z".
              */
             case "FILE_DATE": {
-                metadata.addCitationDate(StandardDateFormat.toDate(OffsetDateTime.parse(value)),
-                                         DateType.CREATION, MetadataBuilder.Scope.ALL);
+                addCitationDate(StandardDateFormat.toDate(OffsetDateTime.parse(value)),
+                                DateType.CREATION, MetadataBuilder.Scope.ALL);
                 break;
             }
             /*
@@ -501,7 +499,7 @@ final class LandsatReader {
              * Value can be "L1T" or "L1GT".
              */
             case "DATA_TYPE": {
-                metadata.setProcessingLevelCode("Landsat", value);
+                setProcessingLevelCode("Landsat", value);
                 break;
             }
             /*
@@ -509,8 +507,7 @@ final class LandsatReader {
              * Value can be "GLS2000", "RAMP" or "GTOPO30".
              */
             case "ELEVATION_SOURCE": {
-                metadata.addSource(value, ScopeCode.MODEL,
-                        Vocabulary.formatInternational(Vocabulary.Keys.DigitalElevationModel));
+                addSource(value, ScopeCode.MODEL, Vocabulary.formatInternational(Vocabulary.Keys.DigitalElevationModel));
                 break;
             }
             /*
@@ -520,12 +517,12 @@ final class LandsatReader {
             case "OUTPUT_FORMAT": {
                 if (Constants.GEOTIFF.equalsIgnoreCase(value)) try {
                     value = Constants.GEOTIFF;              // Because 'metadata.setFormat(…)'
is case-sensitive.
-                    metadata.setFormat(value);
+                    setFormat(value);
                     break;
                 } catch (MetadataStoreException e) {
                     warning(key, null, e);
                 }
-                metadata.addFormatName(value);
+                addFormatName(value);
                 break;
             }
             /*
@@ -533,7 +530,7 @@ final class LandsatReader {
              * Example: "LANDSAT_8".
              */
             case "SPACECRAFT_ID": {
-                metadata.addPlatform(null, value);
+                addPlatform(null, value);
                 break;
             }
             /*
@@ -541,7 +538,7 @@ final class LandsatReader {
              * Example: "OLI", "TIRS" or "OLI_TIRS".
              */
             case "SENSOR_ID": {
-                metadata.addInstrument(null, value);
+                addInstrument(null, value);
                 break;
             }
             /*
@@ -617,7 +614,7 @@ final class LandsatReader {
             case "GRID_CELL_SIZE_PANCHROMATIC":
             case "GRID_CELL_SIZE_REFLECTIVE":
             case "GRID_CELL_SIZE_THERMAL": {
-                metadata.addResolution(Double.parseDouble(value));
+                addResolution(Double.parseDouble(value));
                 break;
             }
             /*
@@ -652,7 +649,7 @@ final class LandsatReader {
              */
             case "CLOUD_COVER": {
                 final double v = Double.parseDouble(value);
-                if (v >= 0) metadata.setCloudCoverPercentage(v);
+                if (v >= 0) setCloudCoverPercentage(v);
                 break;
             }
             /*
@@ -662,7 +659,7 @@ final class LandsatReader {
              * A negative value indicates angles to the west or counterclockwise from the
north.
              */
             case "SUN_AZIMUTH": {
-                metadata.setIlluminationAzimuthAngle(Double.parseDouble(value));
+                setIlluminationAzimuthAngle(Double.parseDouble(value));
                 break;
             }
             /*
@@ -672,7 +669,7 @@ final class LandsatReader {
              * Note: for reflectance calculation, the sun zenith angle is needed, which is
90 - sun elevation angle.
              */
             case "SUN_ELEVATION": {
-                metadata.setIlluminationElevationAngle(Double.parseDouble(value));
+                setIlluminationElevationAngle(Double.parseDouble(value));
                 break;
             }
 
@@ -738,7 +735,7 @@ final class LandsatReader {
                 if ("UTM".equalsIgnoreCase(value)) {
                     projection = null;
                 } else if ("PS".equalsIgnoreCase(value)) try {
-                    projection = DefaultFactories.forBuildin(MathTransformFactory.class)
+                    projection = factories.getMathTransformFactory()
                                     .getDefaultParameters(Constants.EPSG + ':' + PolarStereographicB.IDENTIFIER);
                     utmZone = -1;
                 } catch (NoSuchIdentifierException e) {
@@ -849,9 +846,9 @@ final class LandsatReader {
         if (st != null) {
             sceneTime = null;                   // Clear now in case an exception it thrown
below.
             final Date t = StandardDateFormat.toDate(st);
-            metadata.addAcquisitionTime(t);
+            addAcquisitionTime(t);
             try {
-                metadata.addTemporalExtent(t, t);
+                addTemporalExtent(t, t);
             } catch (UnsupportedOperationException e) {
                 // May happen if the temporal module (which is optional) is not on the classpath.
                 warning(null, null, e);
@@ -896,9 +893,9 @@ final class LandsatReader {
      * @throws FactoryException if an error occurred while creating the Coordinate Reference
System.
      */
     final Metadata getMetadata() throws FactoryException {
-        metadata.addLanguage(Locale.ENGLISH, MetadataBuilder.Scope.METADATA);
-        metadata.addResourceScope(ScopeCode.COVERAGE, null);
-        metadata.addTopicCategory(TopicCategory.GEOSCIENTIFIC_INFORMATION);
+        addLanguage(Locale.ENGLISH, MetadataBuilder.Scope.METADATA);
+        addResourceScope(ScopeCode.COVERAGE, null);
+        addTopicCategory(TopicCategory.GEOSCIENTIFIC_INFORMATION);
         try {
             flushSceneTime();
         } catch (DateTimeException e) {
@@ -908,11 +905,11 @@ final class LandsatReader {
         /*
          * Create the Coordinate Reference System. We normally have only one of UTM or Polar
Stereographic,
          * but this block is nevertheless capable to take both (such metadata are likely
to be invalid, but
-         * we can not guess which of the two CRS is correct).
+         * we can not guess which one of the two CRS is correct).
          */
         if (datum != null) {
             if (utmZone > 0) {
-                metadata.addReferenceSystem(datum.universal(1, TransverseMercator.Zoner.UTM.centralMeridian(utmZone)));
+                addReferenceSystem(datum.universal(1, TransverseMercator.Zoner.UTM.centralMeridian(utmZone)));
             }
             if (projection != null) {
                 final double sp = projection.parameter(Constants.STANDARD_PARALLEL_1).doubleValue();
@@ -924,28 +921,28 @@ final class LandsatReader {
                         || projection.parameter(Constants.FALSE_NORTHING)  .doubleValue()
!= 0
                         || projection.parameter(Constants.CENTRAL_MERIDIAN).doubleValue()
!= 0)
                 {
-                    crs = ReferencingUtilities.createProjectedCRS(
-                            Collections.singletonMap(ProjectedCRS.NAME_KEY, "Polar stereographic"),
-                            datum.geographic(), projection, crs.getCoordinateSystem());
+                    crs = new GeodeticObjectBuilder(listeners.getLocale())
+                            .addName("Polar stereographic").setConversion(projection)
+                            .createProjectedCRS(datum.geographic(), crs.getCoordinateSystem());
                 }
-                metadata.addReferenceSystem(crs);
+                addReferenceSystem(crs);
             }
         }
         /*
          * Set information about envelope (or geographic area) and grid size.
          */
         if (toBoundingBox(GEOGRAPHIC)) {
-            metadata.addExtent(corners, GEOGRAPHIC);
+            addExtent(corners, GEOGRAPHIC);
         }
         for (int i = 0; i < gridSizes.length; i += DIM) {
             final int width  = gridSizes[i  ];
             final int height = gridSizes[i+1];
             if ((width | height) != 0) {
-                metadata.newGridRepresentation(MetadataBuilder.GridType.GEORECTIFIED);
-                metadata.setAxisName(0, DimensionNameType.SAMPLE);
-                metadata.setAxisName(1, DimensionNameType.LINE);
-                metadata.setAxisSize(0, Integer.toUnsignedLong(width));
-                metadata.setAxisSize(1, Integer.toUnsignedLong(height));
+                newGridRepresentation(MetadataBuilder.GridType.GEORECTIFIED);
+                setAxisName(0, DimensionNameType.SAMPLE);
+                setAxisName(1, DimensionNameType.LINE);
+                setAxisSize(0, Integer.toUnsignedLong(width));
+                setAxisSize(1, Integer.toUnsignedLong(height));
             }
         }
         /*
@@ -953,8 +950,8 @@ final class LandsatReader {
          * then continue adding some more specific metadata elements by ourself. For example
information about
          * bands are splitted in 3 different AttributeGroups based on their grid size.
          */
-        metadata.setISOStandards(true);
-        final DefaultMetadata result = metadata.build(false);
+        setISOStandards(true);
+        final DefaultMetadata result = build(false);
         if (result != null) {
             /*
              * Set information about all non-null bands. The bands are categorized in three
groups:
diff --git a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
index 01e5957..d282ca5 100644
--- a/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
+++ b/storage/sis-geotiff/src/main/java/org/apache/sis/storage/geotiff/CRSBuilder.java
@@ -1373,7 +1373,7 @@ final class CRSBuilder extends ReferencingFactoryContainer {
                 final Unit<Angle>   angularUnit = createUnit(GeoKeys.AngularUnits,
GeoKeys.AngularUnitSize, Angle.class, Units.DEGREE);
                 final GeographicCRS baseCRS     = createGeographicCRS(false, angularUnit);
                 final Conversion    projection  = createConversion(name, angularUnit, linearUnit);
-                CartesianCS cs = ReferencingUtilities.standardProjectedCS(getCSAuthorityFactory());
+                CartesianCS cs = getStandardProjectedCS();
                 if (!Units.METRE.equals(linearUnit)) {
                     cs = replaceLinearUnit(cs, linearUnit);
                 }
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/CRSBuilder.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/CRSBuilder.java
index d3d6b60..7d3ed5f 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/CRSBuilder.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/CRSBuilder.java
@@ -45,7 +45,6 @@ import org.apache.sis.referencing.crs.AbstractCRS;
 import org.apache.sis.referencing.crs.DefaultGeographicCRS;
 import org.apache.sis.referencing.crs.DefaultGeocentricCRS;
 import org.apache.sis.internal.referencing.provider.Equirectangular;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.system.DefaultFactories;
 import org.apache.sis.internal.util.TemporalUtilities;
 import org.apache.sis.storage.DataStoreContentException;
@@ -672,7 +671,7 @@ previous:   for (int i=components.size(); --i >= 0;) {
             sphericalDatum = decoder.convention().defaultHorizontalCRS(true);
             datum = sphericalDatum.datum();
             if (isPredefinedCS(Units.METRE)) {
-                coordinateSystem = ReferencingUtilities.standardProjectedCS(decoder.getCSAuthorityFactory());
+                coordinateSystem = decoder.getStandardProjectedCS();
             }
         }
 
diff --git a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
index 44e7282..eaba501 100644
--- a/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
+++ b/storage/sis-netcdf/src/main/java/org/apache/sis/internal/netcdf/GridMapping.java
@@ -57,7 +57,6 @@ import org.apache.sis.internal.metadata.AxisDirections;
 import org.apache.sis.storage.DataStoreContentException;
 import org.apache.sis.coverage.grid.GridGeometry;
 import org.apache.sis.coverage.grid.GridExtent;
-import org.apache.sis.internal.referencing.ReferencingUtilities;
 import org.apache.sis.internal.referencing.provider.PseudoPlateCarree;
 import org.apache.sis.internal.system.Modules;
 import org.apache.sis.internal.util.Constants;
@@ -230,7 +229,7 @@ final class GridMapping {
             } else {
                 Map<String,?> properties = properties(definition, Convention.CONVERSION_NAME,
node.getName());
                 final Conversion conversion = opFactory.createDefiningConversion(properties,
method, parameters);
-                final CartesianCS cs = ReferencingUtilities.standardProjectedCS(node.decoder.getCSAuthorityFactory());
+                final CartesianCS cs = node.decoder.getStandardProjectedCS();
                 properties = properties(definition, Convention.PROJECTED_CRS_NAME, conversion);
                 final ProjectedCRS p = node.decoder.getCRSFactory().createProjectedCRS(properties,
baseCRS, conversion, cs);
                 baseToCRS = p.getConversionFromBase().getMathTransform();


Mime
View raw message