/** * Returns the datum associated to the given object, or {@code null} if none. */ private static GeodeticDatum datum(final IdentifiedObject object) { if (object instanceof GeodeticDatum) { return (GeodeticDatum) object; } if (object instanceof GeodeticCRS) { return ((GeodeticCRS) object).getDatum(); } return null; }
/** * Verifies the CRS name, datum and axes for {@code GEODCRS[“NAD83”]}. * This method does not verify the remark, since it is not included in the components of {@code COMPOUNDCRS[…]}. * * @param degree value of {@link org.opengis.test.Units#degree()} (for fetching it only once per test). * @param metre value of {@link org.opengis.test.Units#metre()} (for fetching it only once per test). */ private void verifyNAD23(final GeodeticCRS crs, final boolean hasIdentifier, final Unit<Angle> degree, final Unit<Length> metre) { final GeodeticDatum datum; verifyIdentification (crs, "NAD83", hasIdentifier ? "4269" : null); verifyDatum (datum = crs.getDatum(), "North American Datum 1983"); verifyFlattenedSphere (datum.getEllipsoid(), "GRS 1980", 6378137, 298.257222101, metre); verifyPrimeMeridian (datum.getPrimeMeridian(), null, 0, degree); verifyCoordinateSystem(crs.getCoordinateSystem(), EllipsoidalCS.class, new AxisDirection[] {NORTH,EAST}, degree); }
verifyDatum (datum = crs.getDatum(), "Japanese Geodetic Datum 2000"); verifyFlattenedSphere (datum.getEllipsoid(), "GRS 1980", 6378137, 298.257222101, metre); verifyPrimeMeridian (datum.getPrimeMeridian(), null, 0, degree); verifyAxisAbbreviations(cs = crs.getCoordinateSystem(), "X", "Y", "Z"); verifyCoordinateSystem (cs, CartesianCS.class, new AxisDirection[] {GEOCENTRIC_X, GEOCENTRIC_Y, GEOCENTRIC_Z}, metre); verifyGeographicExtent (extent = crs.getDomainOfValidity(), "Japan", 17.09, 122.38, 46.05, 157.64); verifyTimeExtent (extent, new Date(1017619200000L), new Date(1319155200000L), 1); assertNullOrEquals("scope", "Geodesy, topographic mapping and cadastre", crs.getScope()); assertNullOrEquals("remark", "注:JGD2000ジオセントリックは現在JGD2011に代わりました。", crs.getRemarks());
assertEquals("name", "WGS 84", crs.getName().getCode()); assertIsWorld(crs.getDomainOfValidity(), isExtentMandatory); assertIsWGS84(crs.getDatum(), isExtentMandatory); final CoordinateSystem cs = crs.getCoordinateSystem(); assertInstanceOf("coordinateSystem", EllipsoidalCS.class, cs); assertIsGeodetic2D((EllipsoidalCS) cs, isRangeMandatory);
verifyDatum (datum = crs.getDatum(), "Nouvelle Triangulation Francaise"); verifyFlattenedSphere (datum.getEllipsoid(), "Clarke 1880 (IGN)", 6378249.2, 293.4660213, metre); verifyPrimeMeridian (datum.getPrimeMeridian(), "Paris", 2.5969213, grad); verifyCoordinateSystem(crs.getCoordinateSystem(), EllipsoidalCS.class, new AxisDirection[] {NORTH,EAST}, grad); assertNullOrEquals("remark", "Nouvelle Triangulation Française", crs.getRemarks());
/** * Verifies the given geographic or geocentric CRS. * * @param crsCode the code of the created CRS. * @param crs the CRS to verify. * @param expectedDirections either {@link #GEOGRAPHIC_2D}, {@link #GEOGRAPHIC_3D} or {@link #GEOCENTRIC}. */ private void verifyGeodeticCRS(final int crsCode, final GeodeticCRS crs, final AxisDirection[] expectedDirections) { assertNotNull("GeodeticCRS", crs); // Geodetic CRS identifier. assertContainsCode("GeodeticCRS.getIdentifiers()", "EPSG", crsCode, crs.getIdentifiers()); // Geodetic CRS name. if (isStandardNameSupported) { configurationTip = Configuration.Key.isStandardNameSupported; assertEquals("GeodeticCRS.getName()", crsName, getVerifiableName(crs)); configurationTip = null; } // Geodetic CRS datum. final GeodeticDatum crsDatum = crs.getDatum(); assertNotNull("GeodeticCRS.getDatum()", crsDatum); verifyGeodeticDatum(crsDatum); // Geodetic CRS coordinate system. final CoordinateSystem cs = crs.getCoordinateSystem(); assertNotNull("GeodeticCRS.getCoordinateSystem()", cs); assertEquals("GeodeticCRS.getCoordinateSystem().getDimension()", expectedDirections.length, cs.getDimension()); assertAxisDirectionsEqual("GeodeticCRS.getCoordinateSystem().getAxis(*)", cs, expectedDirections); }
verifyAxisAbbreviations(crs.getCoordinateSystem(), null, null, "h");
assertNullOrEquals("remark", "1986 realisation", crs.getRemarks());
/** * Verifies the CRS name, datum and axes for {@code GEODCRS[“WGS 84”]}. * This method does not verify axis abbreviations. * * @param crs the Coordinate Reference System which is expected to be WGS 84. * @param is3D whether the CRS contains an ellipsoidal height axis. * @param degree value of {@link org.opengis.test.Units#degree()} (for fetching it only once per test). * @param metre value of {@link org.opengis.test.Units#metre()} (for fetching it only once per test). */ private void verifyWGS84(final GeodeticCRS crs, final boolean is3D, final Unit<Angle> degree, final Unit<Length> metre) { final GeodeticDatum datum; final AxisDirection[] directions; verifyIdentification (crs, "WGS 84", null); verifyDatum (datum = crs.getDatum(), "World Geodetic System 1984"); verifyFlattenedSphere(datum.getEllipsoid(), "WGS 84", 6378137, 298.257223563, metre); verifyPrimeMeridian (datum.getPrimeMeridian(), null, 0, degree); directions = new AxisDirection[is3D ? 3 : 2]; directions[0] = NORTH; directions[1] = EAST; if (is3D) { directions[2] = UP; } verifyCoordinateSystem(crs.getCoordinateSystem(), EllipsoidalCS.class, directions, degree, degree, metre); }
verifyDatum (datum = crs.getDatum(), "Pulkovo 1995"); verifyFlattenedSphere (datum.getEllipsoid(), "Krassowsky 1940", 6378245, 298.3, metre); verifyPrimeMeridian (datum.getPrimeMeridian(), null, 0, degree); verifyCoordinateSystem(crs.getCoordinateSystem(), EllipsoidalCS.class, new AxisDirection[] {NORTH,EAST}, degree); assertNullOrEquals("remark", "Система Геодеэических Координвт года 1995(СК-95)", crs.getRemarks());
/** * Returns the datum associated to the given object, or {@code null} if none. */ private static GeodeticDatum datum(final IdentifiedObject object) { if (object instanceof GeodeticDatum) { return (GeodeticDatum) object; } if (object instanceof GeodeticCRS) { return ((GeodeticCRS) object).getDatum(); } return null; }
final CoordinateSystem cs = object.getCoordinateSystem(); mandatory("GeodeticCRS: shall have a CoordinateSystem.", cs); if (!skipGeographic && cs instanceof EllipsoidalCS) { fail("GeodeticCRS: unknown CoordinateSystem of type " + cs.getClass().getCanonicalName() + '.'); final GeodeticDatum datum = object.getDatum(); mandatory("GeodeticCRS: shall have a Datum.", datum); container.validate(datum);
/** * Constructs a new coordinate reference system with the same values than the specified one. * This copy constructor provides a way to convert an arbitrary implementation into a SIS one * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. * * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p> * * @param crs the coordinate reference system to copy. */ protected DefaultGeodeticCRS(final GeodeticCRS crs) { super(crs); datum = crs.getDatum(); }
throws FactoryException final GeodeticDatum sourceDatum = sourceCRS.getDatum(); final GeodeticDatum targetDatum = targetCRS.getDatum(); Matrix datumShift = null; parameters.parameter("dim").setValue(geographic.getCoordinateSystem().getDimension()); } else {
/** * Constructs a new coordinate reference system with the same values than the specified one. * This copy constructor provides a way to convert an arbitrary implementation into a SIS one * or a user-defined one (as a subclass), usually in order to leverage some implementation-specific API. * * <p>This constructor performs a shallow copy, i.e. the properties are not cloned.</p> * * @param crs the coordinate reference system to copy. */ protected DefaultGeodeticCRS(final GeodeticCRS crs) { super(crs); datum = crs.getDatum(); }
/** * Returns the Greenwich longitude of the prime meridian of the given CRS in degrees. * If the prime meridian uses an other unit than degrees, then the value will be converted. * * @param crs the coordinate reference system from which to get the prime meridian. * @return the Greenwich longitude (in degrees) of the prime meridian of the given CRS. * * @see org.apache.sis.referencing.datum.DefaultPrimeMeridian#getGreenwichLongitude(Unit) * * @since 0.5 */ public static double getGreenwichLongitude(final GeodeticCRS crs) { ArgumentChecks.ensureNonNull("crs", crs); return ReferencingUtilities.getGreenwichLongitude(crs.getDatum().getPrimeMeridian(), Units.DEGREE); }
/** * Returns the Greenwich longitude of the prime meridian of the given CRS in degrees. * If the prime meridian uses an other unit than degrees, then the value will be converted. * * @param crs the coordinate reference system from which to get the prime meridian. * @return the Greenwich longitude (in degrees) of the prime meridian of the given CRS. * * @see org.apache.sis.referencing.datum.DefaultPrimeMeridian#getGreenwichLongitude(Unit) * * @since 0.5 */ public static double getGreenwichLongitude(final GeodeticCRS crs) { ArgumentChecks.ensureNonNull("crs", crs); return ReferencingUtilities.getGreenwichLongitude(crs.getDatum().getPrimeMeridian(), Units.DEGREE); }
return ((GeodeticCRS) crs).getDatum().getEllipsoid(); } else { return null; // Geocentric CRS.
return ((GeodeticCRS) crs).getDatum().getEllipsoid(); } else { return null; // Geocentric CRS.
/** * Changes only the coordinate system of the given CRS, which is supposed geographic. */ private static GeographicCRS changeCS(final CoordinateReferenceSystem crs, final EllipsoidalCS cs) { return new DefaultGeographicCRS(Collections.singletonMap(DefaultGeographicCRS.NAME_KEY, crs.getName()), ((GeodeticCRS) crs).getDatum(), cs); }