Search in sources :

Example 11 with TemporalCRS

use of org.opengis.referencing.crs.TemporalCRS in project sis by apache.

the class EllipsoidalHeightCombinerTest method testGeographicCRS.

/**
 * Tests {@link EllipsoidalHeightCombiner#createCompoundCRS EllipsoidalHeightCombiner.createCompoundCRS(…)}
 * with a geographic CRS.
 *
 * @throws FactoryException if a CRS can not be created.
 */
@Test
public void testGeographicCRS() throws FactoryException {
    final EllipsoidalHeightCombiner services = create();
    final Map<String, String> properties = Collections.singletonMap(CoordinateReferenceSystem.NAME_KEY, "WGS 84 (4D)");
    final GeographicCRS horizontal = HardCodedCRS.WGS84;
    final GeographicCRS volumetric = HardCodedCRS.WGS84_3D;
    final VerticalCRS vertical = HardCodedCRS.ELLIPSOIDAL_HEIGHT;
    final TemporalCRS temporal = HardCodedCRS.TIME;
    final VerticalCRS geoidal = HardCodedCRS.GRAVITY_RELATED_HEIGHT;
    /*
         * createCompoundCRS(…) should not combine GeographicCRS with non-ellipsoidal height.
         */
    CoordinateReferenceSystem compound = services.createCompoundCRS(properties, horizontal, geoidal, temporal);
    assertArrayEqualsIgnoreMetadata(new SingleCRS[] { horizontal, geoidal, temporal }, CRS.getSingleComponents(compound).toArray());
    /*
         * createCompoundCRS(…) should combine GeographicCRS with ellipsoidal height.
         */
    compound = services.createCompoundCRS(properties, horizontal, vertical);
    assertArrayEqualsIgnoreMetadata(new SingleCRS[] { volumetric }, CRS.getSingleComponents(compound).toArray());
    /*
         * createCompoundCRS(…) should combine GeographicCRS with ellipsoidal height and keep time.
         */
    compound = services.createCompoundCRS(properties, horizontal, vertical, temporal);
    assertArrayEqualsIgnoreMetadata(new SingleCRS[] { volumetric, temporal }, CRS.getSingleComponents(compound).toArray());
    /*
         * Non-standard feature: accept (VerticalCRS + GeodeticCRS) order.
         * The test below use the reverse order for all axes compared to the previous test.
         */
    compound = services.createCompoundCRS(properties, temporal, vertical, HardCodedCRS.WGS84_φλ);
    final Object[] components = CRS.getSingleComponents(compound).toArray();
    assertEquals(2, components.length);
    assertEqualsIgnoreMetadata(temporal, components[0]);
    assertInstanceOf("Shall be a three-dimensional geographic CRS.", GeographicCRS.class, components[1]);
    assertAxisDirectionsEqual("Shall be a three-dimensional geographic CRS.", ((CoordinateReferenceSystem) components[1]).getCoordinateSystem(), AxisDirection.UP, AxisDirection.NORTH, AxisDirection.EAST);
}
Also used : TemporalCRS(org.opengis.referencing.crs.TemporalCRS) VerticalCRS(org.opengis.referencing.crs.VerticalCRS) GeographicCRS(org.opengis.referencing.crs.GeographicCRS) CoordinateReferenceSystem(org.opengis.referencing.crs.CoordinateReferenceSystem) Test(org.junit.Test)

Aggregations

TemporalCRS (org.opengis.referencing.crs.TemporalCRS)11 CoordinateReferenceSystem (org.opengis.referencing.crs.CoordinateReferenceSystem)7 VerticalCRS (org.opengis.referencing.crs.VerticalCRS)5 Test (org.junit.Test)4 DefaultTemporalCRS (org.apache.sis.referencing.crs.DefaultTemporalCRS)3 GeographicCRS (org.opengis.referencing.crs.GeographicCRS)3 TransformException (org.opengis.referencing.operation.TransformException)3 Date (java.util.Date)2 DefaultGeographicBoundingBox (org.apache.sis.metadata.iso.extent.DefaultGeographicBoundingBox)2 DefaultVerticalExtent (org.apache.sis.metadata.iso.extent.DefaultVerticalExtent)2 DependsOnMethod (org.apache.sis.test.DependsOnMethod)2 ProjectedCRS (org.opengis.referencing.crs.ProjectedCRS)2 SingleCRS (org.opengis.referencing.crs.SingleCRS)2 CoordinateSystem (org.opengis.referencing.cs.CoordinateSystem)2 TemporalDatum (org.opengis.referencing.datum.TemporalDatum)2 DateFormat (java.text.DateFormat)1 DecimalFormat (java.text.DecimalFormat)1 Format (java.text.Format)1 NumberFormat (java.text.NumberFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1