use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class EPSGFactoryTest method testCompound.
/**
* Tests the "NTF (Paris) + NGF IGN69 height" compound CRS (EPSG:7400).
* This method tests also the domain of validity.
*
* @throws FactoryException if an error occurred while querying the factory.
*/
@Test
@DependsOnMethod({ "testGeographic2D", "testVertical" })
public void testCompound() throws FactoryException {
final EPSGFactory factory = TestFactorySource.factory;
assumeNotNull(factory);
final CompoundCRS crs = factory.createCompoundCRS("EPSG:7400");
assertEpsgNameAndIdentifierEqual("NTF (Paris) + NGF IGN69 height", 7400, crs);
final List<CoordinateReferenceSystem> components = crs.getComponents();
assertEquals("components.size()", 2, components.size());
assertEpsgNameAndIdentifierEqual("NTF (Paris)", 4807, components.get(0));
assertEpsgNameAndIdentifierEqual("NGF-IGN69 height", 5720, components.get(1));
assertAxisDirectionsEqual("(no EPSG code)", crs.getCoordinateSystem(), AxisDirection.NORTH, AxisDirection.EAST, AxisDirection.UP);
final GeographicBoundingBox bbox = CRS.getGeographicBoundingBox(crs);
assertNotNull("No bounding box. Maybe an older EPSG database is used?", bbox);
assertEquals("southBoundLatitude", 42.33, bbox.getSouthBoundLatitude(), STRICT);
assertEquals("northBoundLatitude", 51.14, bbox.getNorthBoundLatitude(), STRICT);
assertEquals("westBoundLongitude", -4.87, bbox.getWestBoundLongitude(), STRICT);
assertEquals("eastBoundLongitude", 8.23, bbox.getEastBoundLongitude(), STRICT);
assertSame("CRS shall be cached", crs, factory.createCoordinateReferenceSystem("7400"));
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationFinderTest method testSpatioTemporalToDerived.
/**
* Tests conversion from spatio-temporal CRS to a derived CRS.
*
* @throws FactoryException if the operation can not be created.
* @throws TransformException if an error occurred while converting the test points.
*/
@Test
@DependsOnMethod("testProjected4D_to_2D")
public void testSpatioTemporalToDerived() throws FactoryException, TransformException {
final Map<String, Object> properties = new HashMap<>();
properties.put(DerivedCRS.NAME_KEY, "Display");
properties.put("conversion.name", "Display to WGS84");
final GeographicCRS WGS84 = CommonCRS.WGS84.normalizedGeographic();
final CompoundCRS sourceCRS = compound("Test3D", WGS84, CommonCRS.Temporal.UNIX.crs());
final DerivedCRS targetCRS = DefaultDerivedCRS.create(properties, WGS84, null, factory.getOperationMethod("Affine"), MathTransforms.linear(Matrices.create(3, 3, new double[] { 12, 0, 480, 0, -12, 790, 0, 0, 1 })), HardCodedCS.DISPLAY);
final CoordinateOperation operation = finder.createOperation(sourceCRS, targetCRS);
assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
assertSame("targetCRS", targetCRS, operation.getTargetCRS());
transform = operation.getMathTransform();
assertInstanceOf("transform", LinearTransform.class, transform);
assertEquals("sourceDimensions", 3, transform.getSourceDimensions());
assertEquals("targetDimensions", 2, transform.getTargetDimensions());
Assert.assertMatrixEquals("transform.matrix", Matrices.create(3, 4, new double[] { 12, 0, 0, 480, 0, -12, 0, 790, 0, 0, 0, 1 }), ((LinearTransform) transform).getMatrix(), STRICT);
validate();
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationFinderTest method testGeographic3D_to_2D.
/**
* Tests the conversion from a three-dimensional geographic CRS to a two-dimensional geographic CRS.
* The vertical dimension is simply dropped.
*
* @throws FactoryException if the operation can not be created.
* @throws TransformException if an error occurred while converting the test points.
*/
@Test
@DependsOnMethod("testIdentityTransform")
public void testGeographic3D_to_2D() throws FactoryException, TransformException {
final GeographicCRS sourceCRS = CommonCRS.WGS84.geographic3D();
final GeographicCRS targetCRS = CommonCRS.WGS84.geographic();
final CoordinateOperation operation = finder.createOperation(sourceCRS, targetCRS);
assertSame("sourceCRS", sourceCRS, operation.getSourceCRS());
assertSame("targetCRS", targetCRS, operation.getTargetCRS());
assertEquals("name", "Axis changes", operation.getName().getCode());
assertInstanceOf("operation", Conversion.class, operation);
final ParameterValueGroup parameters = ((SingleOperation) operation).getParameterValues();
assertEquals("parameters.descriptor", "Geographic3D to 2D conversion", parameters.getDescriptor().getName().getCode());
assertTrue("parameters.isEmpty", parameters.values().isEmpty());
transform = operation.getMathTransform();
assertInstanceOf("transform", LinearTransform.class, transform);
assertEquals("sourceDimensions", 3, transform.getSourceDimensions());
assertEquals("targetDimensions", 2, transform.getTargetDimensions());
Assert.assertMatrixEquals("transform.matrix", Matrices.create(3, 4, new double[] { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1 }), ((LinearTransform) transform).getMatrix(), STRICT);
isInverseTransformSupported = false;
verifyTransform(new double[] { 30, 10, 20, 20, 30, -10 }, new double[] { 30, 10, 20, 30 });
validate();
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationFinderTest method testGeocentricTranslationInGeographic2D.
/**
* Tests a transformation with a two-dimensional geographic source CRS.
* This method verifies with both a two-dimensional and a three-dimensional target CRS.
*
* @throws ParseException if a CRS used in this test can not be parsed.
* @throws FactoryException if the operation can not be created.
* @throws TransformException if an error occurred while converting the test points.
*/
@Test
@DependsOnMethod("testIdentityTransform")
public void testGeocentricTranslationInGeographic2D() throws ParseException, FactoryException, TransformException {
/*
* NAD27 (EPSG:4267) defined in WKT instead than relying on the CommonCRS.NAD27 constant in order to fix
* the TOWGS84[…] parameter to values that we control. Note that TOWGS84[…] is not a legal WKT 2 element.
* We could mix WKT 1 and WKT 2 elements (SIS allows that), but we nevertheless use WKT 1 for the whole
* string as a matter of principle.
*/
final GeographicCRS sourceCRS = (GeographicCRS) parse("GEOGCS[“NAD27”,\n" + " DATUM[“North American Datum 1927”,\n" + " SPHEROID[“Clarke 1866”, 6378206.4, 294.9786982138982],\n" + // EPSG:1173
" TOWGS84[-8, 160, 176]]," + " PRIMEM[“Greenwich”, 0.0]," + " UNIT[“degree”, 0.017453292519943295],\n" + " AXIS[“Latitude (φ)”, NORTH],\n" + " AXIS[“Longitude (λ)”, EAST],\n" + " AUTHORITY[“EPSG”, “4267”]]");
testGeocentricTranslationInGeographicDomain("Geocentric translations (geog2D domain)", sourceCRS, CommonCRS.WGS84.geographic());
testGeocentricTranslationInGeographicDomain("Geocentric translations (geog3D domain)", sourceCRS, CommonCRS.WGS84.geographic3D());
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationFinderTest method testPositionVectorTransformation.
/**
* Tests a datum shift applied as a position vector transformation in geocentric domain.
* This test does not use the the EPSG geodetic dataset.
*
* @throws ParseException if a CRS used in this test can not be parsed.
* @throws FactoryException if the operation can not be created.
* @throws TransformException if an error occurred while converting the test points.
*
* @see DefaultCoordinateOperationFactoryTest#testPositionVectorTransformation()
* @see <a href="https://issues.apache.org/jira/browse/SIS-364">SIS-364</a>
*
* @since 0.8
*/
@Test
@DependsOnMethod("testGeographicToProjected")
public void testPositionVectorTransformation() throws ParseException, FactoryException, TransformException {
final CoordinateReferenceSystem sourceCRS = CommonCRS.WGS84.geographic();
final CoordinateReferenceSystem targetCRS = parse(AGD66());
final CoordinateOperation operation = finder.createOperation(sourceCRS, targetCRS);
transform = operation.getMathTransform();
tolerance = LINEAR_TOLERANCE;
λDimension = new int[] { 0 };
verifyTransform(expectedAGD66(true), expectedAGD66(false));
validate();
}
Aggregations