use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class DefaultProjectedCRSTest method testWKT1_WithMixedUnits.
/**
* Tests WKT 1 formatting with a somewhat convolved case where the units of the prime meridian is not
* the same than the unit of axes. Since the axis units is what we write in the {@code UNIT[…]} element,
* the WKT formatter need to convert the unit of prime meridian and all parameter angular values.
*
* @throws FactoryException if the CRS creation failed.
*/
@Test
@DependsOnMethod("testWKT1_WithCommonUnits")
public void testWKT1_WithMixedUnits() throws FactoryException {
final ProjectedCRS crs = create(HardCodedCRS.NTF_NORMALIZED_AXES);
// Opportunist check.
Validators.validate(crs);
assertWktEquals(Convention.WKT1, "PROJCS[“NTF (Paris) / Lambert zone II”,\n" + " GEOGCS[“NTF (Paris)”,\n" + " DATUM[“Nouvelle Triangulation Francaise”,\n" + " SPHEROID[“NTF”, 6378249.2, 293.4660212936269]],\n" + // Note the conversion from 2.5969213 grads.
" PRIMEM[“Paris”, 2.33722917],\n" + " UNIT[“degree”, 0.017453292519943295],\n" + " AXIS[“Longitude”, EAST],\n" + " AXIS[“Latitude”, NORTH]],\n" + " PROJECTION[“Lambert_Conformal_Conic_1SP”, AUTHORITY[“EPSG”, “9801”]],\n" + // Note the conversion from 52 grads.
" PARAMETER[“latitude_of_origin”, 46.8],\n" + " PARAMETER[“central_meridian”, 0.0],\n" + " PARAMETER[“scale_factor”, 0.99987742],\n" + " PARAMETER[“false_easting”, 600000.0],\n" + " PARAMETER[“false_northing”, 2200000.0],\n" + " UNIT[“metre”, 1],\n" + " AXIS[“Easting”, EAST],\n" + " AXIS[“Northing”, NORTH],\n" + " AUTHORITY[“EPSG”, “27572”]]", crs);
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class DefaultProjectedCRSTest method testWKT1_WithCommonUnits.
/**
* Tests WKT 1 formatting using {@link Convention#WKT1_COMMON_UNITS}.
*
* @throws FactoryException if the CRS creation failed.
*/
@Test
@DependsOnMethod("testWKT1")
public void testWKT1_WithCommonUnits() throws FactoryException {
final ProjectedCRS crs = create(HardCodedCRS.NTF);
assertWktEquals(Convention.WKT1_COMMON_UNITS, "PROJCS[“NTF (Paris) / Lambert zone II”,\n" + " GEOGCS[“NTF (Paris)”,\n" + " DATUM[“Nouvelle Triangulation Francaise”,\n" + " SPHEROID[“NTF”, 6378249.2, 293.4660212936269]],\n" + // Note the conversion from 2.5969213 grads.
" PRIMEM[“Paris”, 2.33722917],\n" + " UNIT[“grad”, 0.015707963267948967],\n" + " AXIS[“Longitude”, EAST],\n" + " AXIS[“Latitude”, NORTH]],\n" + " PROJECTION[“Lambert_Conformal_Conic_1SP”, AUTHORITY[“EPSG”, “9801”]],\n" + // Note the conversion from 52 grads.
" PARAMETER[“latitude_of_origin”, 46.8],\n" + " PARAMETER[“central_meridian”, 0.0],\n" + " PARAMETER[“scale_factor”, 0.99987742],\n" + " PARAMETER[“false_easting”, 600000.0],\n" + " PARAMETER[“false_northing”, 2200000.0],\n" + " UNIT[“meter”, 1],\n" + " AXIS[“Easting”, EAST],\n" + " AXIS[“Northing”, NORTH],\n" + " AUTHORITY[“EPSG”, “27572”]]", crs);
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class DefaultProjectedCRSTest method testWKT2_Simplified.
/**
* Tests WKT 2 formatting in simplified mode.
*
* @throws FactoryException if the CRS creation failed.
*/
@Test
@DependsOnMethod("testWKT1")
public void testWKT2_Simplified() throws FactoryException {
ProjectedCRS crs = create(HardCodedCRS.NTF);
assertWktEquals(Convention.WKT2_SIMPLIFIED, "ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" + " BaseGeodCRS[“NTF (Paris)”,\n" + " Datum[“Nouvelle Triangulation Francaise”,\n" + " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" + " PrimeMeridian[“Paris”, 2.5969213],\n" + " Unit[“grad”, 0.015707963267948967]],\n" + " Conversion[“Lambert zone II”,\n" + " Method[“Lambert Conic Conformal (1SP)”],\n" + " Parameter[“Latitude of natural origin”, 52.0],\n" + " Parameter[“Longitude of natural origin”, 0.0],\n" + " Parameter[“Scale factor at natural origin”, 0.99987742],\n" + " Parameter[“False easting”, 600000.0],\n" + " Parameter[“False northing”, 2200000.0]],\n" + " CS[Cartesian, 2],\n" + " Axis[“Easting (E)”, east],\n" + " Axis[“Northing (N)”, north],\n" + " Unit[“metre”, 1],\n" + " Id[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]", crs);
/*
* Try again, but with mixed units. It should force the formatter to add explicit
* unit declaration in PrimeMeridian[…] and some Parameter[…] elements.
*/
crs = create(HardCodedCRS.NTF_NORMALIZED_AXES);
assertWktEquals(Convention.WKT2_SIMPLIFIED, "ProjectedCRS[“NTF (Paris) / Lambert zone II”,\n" + " BaseGeodCRS[“NTF (Paris)”,\n" + " Datum[“Nouvelle Triangulation Francaise”,\n" + " Ellipsoid[“NTF”, 6378249.2, 293.4660212936269]],\n" + " PrimeMeridian[“Paris”, 2.5969213, Unit[“grad”, 0.015707963267948967]],\n" + " Unit[“degree”, 0.017453292519943295]],\n" + " Conversion[“Lambert zone II”,\n" + " Method[“Lambert Conic Conformal (1SP)”],\n" + " Parameter[“Latitude of natural origin”, 52.0, Unit[“grad”, 0.015707963267948967]],\n" + " Parameter[“Longitude of natural origin”, 0.0],\n" + " Parameter[“Scale factor at natural origin”, 0.99987742],\n" + " Parameter[“False easting”, 600000.0],\n" + " Parameter[“False northing”, 2200000.0]],\n" + " CS[Cartesian, 2],\n" + " Axis[“Easting (E)”, east],\n" + " Axis[“Northing (N)”, north],\n" + " Unit[“metre”, 1],\n" + " Id[“EPSG”, 27572, URI[“urn:ogc:def:crs:EPSG::27572”]]]", crs);
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class DefaultProjectedCRSTest method testEquals.
/**
* Tests {@link DefaultProjectedCRS#equals(Object, ComparisonMode)}.
* In particular, we want to test the ability to ignore axis order of the base CRS in "ignore metadata" mode.
*
* @throws FactoryException if the CRS creation failed.
*
* @since 0.7
*/
@Test
public void testEquals() throws FactoryException {
final ProjectedCRS standard = create(CommonCRS.WGS84.geographic());
final ProjectedCRS normalized = create(CommonCRS.WGS84.normalizedGeographic());
assertFalse("STRICT", ((LenientComparable) standard).equals(normalized, ComparisonMode.STRICT));
assertFalse("BY_CONTRACT", ((LenientComparable) standard).equals(normalized, ComparisonMode.BY_CONTRACT));
assertTrue("IGNORE_METADATA", ((LenientComparable) standard).equals(normalized, ComparisonMode.IGNORE_METADATA));
assertTrue("APPROXIMATIVE", ((LenientComparable) standard).equals(normalized, ComparisonMode.APPROXIMATIVE));
assertTrue("ALLOW_VARIANT", ((LenientComparable) standard).equals(normalized, ComparisonMode.ALLOW_VARIANT));
}
use of org.opengis.referencing.crs.ProjectedCRS in project sis by apache.
the class DefaultProjectedCRSTest method testWKT2_ForEquirectangular.
/**
* Tests formatting of “Equidistant Cylindrical (Spherical)” projected CRS. This one is a special case
* because it is simplified to an affine transform. The referencing module should be able to find the
* original projection parameters.
*
* @throws FactoryException if the CRS creation failed.
*/
@Test
@DependsOnMethod("testWKT2_Simplified")
public void testWKT2_ForEquirectangular() throws FactoryException {
final ProjectedCRS crs = new GeodeticObjectBuilder().setConversionMethod("Equirectangular").setConversionName("Equidistant Cylindrical (Spherical)").setParameter("False easting", 1000, Units.METRE).setParameter("False northing", 2000, Units.METRE).addName("Equidistant Cylindrical (Spherical)").createProjectedCRS(HardCodedCRS.WGS84, HardCodedCS.PROJECTED);
assertWktEquals(Convention.WKT2_SIMPLIFIED, "ProjectedCRS[“Equidistant Cylindrical (Spherical)”,\n" + " BaseGeodCRS[“WGS 84”,\n" + " Datum[“World Geodetic System 1984”,\n" + " Ellipsoid[“WGS84”, 6378137.0, 298.257223563]],\n" + " Unit[“degree”, 0.017453292519943295]],\n" + " Conversion[“Equidistant Cylindrical (Spherical)”,\n" + " Method[“Equidistant Cylindrical (Spherical)”],\n" + " Parameter[“Latitude of 1st standard parallel”, 0.0],\n" + " Parameter[“Longitude of natural origin”, 0.0],\n" + " Parameter[“False easting”, 1000.0],\n" + " Parameter[“False northing”, 2000.0]],\n" + " CS[Cartesian, 2],\n" + " Axis[“Easting (E)”, east],\n" + " Axis[“Northing (N)”, north],\n" + " Unit[“metre”, 1]]", crs);
}
Aggregations