use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationFinderTest method testGeocentricTranslationInGeographic3D.
/**
* Tests a transformation with a three-dimensional geographic source CRS.
* This method verifies with both a three-dimensional and a two-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("testGeocentricTranslationInGeographic2D")
public void testGeocentricTranslationInGeographic3D() throws ParseException, FactoryException, TransformException {
final GeographicCRS sourceCRS = (GeographicCRS) parse("GeodeticCRS[“NAD27”,\n" + " Datum[“North American Datum 1927”,\n" + " Ellipsoid[“Clarke 1866”, 6378206.4, 294.9786982138982],\n" + // See comment in above test.
" ToWGS84[-8, 160, 176]]," + " CS[ellipsoidal, 3],\n" + " Axis[“Latitude (φ)”, NORTH, Unit[“degree”, 0.017453292519943295]],\n" + " Axis[“Longitude (λ)”, EAST, Unit[“degree”, 0.017453292519943295]],\n" + " Axis[“Height (h)”, UP, Unit[“m”, 1]]]");
testGeocentricTranslationInGeographicDomain("Geocentric translations (geog3D domain)", sourceCRS, CommonCRS.WGS84.geographic3D());
// Because lost of height values changes (φ,λ) results.
isInverseTransformSupported = false;
testGeocentricTranslationInGeographicDomain("Geocentric translations (geog3D domain)", sourceCRS, CommonCRS.WGS84.geographic());
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationRegistryTest method testLongitudeRotationBetweenNormalizedGeographic3D.
/**
* Tests <cite>"NTF (Paris) to WGS 84 (1)"</cite> operation with three-dimensional source and target CRS
* having different axis order and units than the ones declared in the EPSG 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.
*/
@Test
@DependsOnMethod({ "testLongitudeRotationBetweenNormalizedCRS", "testLongitudeRotationBetweenGeographic3D" })
public void testLongitudeRotationBetweenNormalizedGeographic3D() throws ParseException, FactoryException, TransformException {
final CoordinateReferenceSystem sourceCRS = parse("GeodeticCRS[“NTF (Paris)”,\n" + " $NTF,\n" + " PrimeMeridian[“Paris”, 2.33722917],\n" + " CS[ellipsoidal, 3],\n" + " Axis[“Longitude (λ)”, EAST, Unit[“degree”, 0.017453292519943295]],\n" + " Axis[“Latitude (φ)”, NORTH, Unit[“degree”, 0.017453292519943295]],\n" + " Axis[“Height (h)”, UP, Unit[“m”, 1]]]");
final CoordinateReferenceSystem targetCRS = DefaultGeographicCRS.castOrCopy(CommonCRS.WGS84.geographic3D()).forConvention(AxesConvention.NORMALIZED);
final CoordinateOperation operation = createOperation(sourceCRS, targetCRS);
verifyNTF(operation, "geog3D domain", false);
transform = operation.getMathTransform();
tolerance = Formulas.ANGULAR_TOLERANCE;
zTolerance = Formulas.LINEAR_TOLERANCE;
zDimension = new int[] { 2 };
λDimension = new int[] { 1 };
// Because GeoAPI 3.0 does not distinguish z axis from other axes (fixed in GeoAPI 3.1).
tolerance = zTolerance;
verifyTransform(// in degrees east of Paris
new double[] { 0.088442691, 48.844512250, 20.00 }, // in degrees east of Greenwich
new double[] { 2.424952028, 48.844443528, 63.15 });
validate();
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationRegistryTest method testLongitudeRotationBetweenGeographic3D.
/**
* Tests <cite>"NTF (Paris) to WGS 84 (1)"</cite> operation with three-dimensional source and target CRS.
* {@link CoordinateOperationRegistry} should be able to find the operation despite the difference in
* number of dimensions.
*
* @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("testLongitudeRotationBetweenConformCRS")
public void testLongitudeRotationBetweenGeographic3D() throws ParseException, FactoryException, TransformException {
final CoordinateReferenceSystem sourceCRS = parse("GeodeticCRS[“NTF (Paris)”,\n" + " $NTF,\n" + " PrimeMeridian[“Paris”, 2.5969213],\n" + " CS[ellipsoidal, 3],\n" + " Axis[“Latitude (φ)”, NORTH, Unit[“grad”, 0.015707963267948967]],\n" + " Axis[“Longitude (λ)”, EAST, Unit[“grad”, 0.015707963267948967]],\n" + " Axis[“Height (h)”, UP, Unit[“m”, 1]]]");
final CoordinateReferenceSystem targetCRS = CommonCRS.WGS84.geographic3D();
final CoordinateOperation operation = createOperation(sourceCRS, targetCRS);
verifyNTF(operation, "geog3D domain", false);
transform = operation.getMathTransform();
tolerance = Formulas.ANGULAR_TOLERANCE;
zTolerance = Formulas.LINEAR_TOLERANCE;
zDimension = new int[] { 2 };
λDimension = new int[] { 1 };
// Because GeoAPI 3.0 does not distinguish z axis from other axes (fixed in GeoAPI 3.1).
tolerance = zTolerance;
verifyTransform(// in grads east of Paris
new double[] { 54.271680278, 0.098269657, 20.00 }, // in degrees east of Greenwich
new double[] { 48.844443528, 2.424952028, 63.15 });
validate();
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class CoordinateOperationRegistryTest method testInverse.
/**
* Tests the inverse of <cite>"NTF (Paris) to WGS 84 (1)"</cite> operation, also with different axis order.
*
* @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("testLongitudeRotationBetweenNormalizedCRS")
public void testInverse() throws ParseException, FactoryException, TransformException {
final CoordinateReferenceSystem targetCRS = parse("GeodeticCRS[“NTF (Paris)”,\n" + " $NTF,\n" + " PrimeMeridian[“Paris”, 2.5969213],\n" + " CS[ellipsoidal, 2],\n" + " Axis[“Longitude (λ)”, EAST],\n" + " Axis[“Latitude (φ)”, NORTH],\n" + " Unit[“grad”, 0.015707963267948967]]");
final CoordinateReferenceSystem sourceCRS = CommonCRS.WGS84.normalizedGeographic();
final CoordinateOperation operation = createOperation(sourceCRS, targetCRS);
transform = operation.getMathTransform();
tolerance = Formulas.ANGULAR_TOLERANCE;
λDimension = new int[] { 1 };
verifyTransform(// in degrees east of Greenwich
new double[] { 2.424952028, 48.844443528 }, // in grads east of Paris
new double[] { 0.098269657, 54.271680278 });
validate();
}
use of org.apache.sis.test.DependsOnMethod in project sis by apache.
the class DefaultConversionTest method testWithInterpolationCRS.
/**
* Tests {@link DefaultConversion#specialize DefaultConversion.specialize(…)} with an interpolation CRS.
* In this test, we invent an imaginary scenario where the longitude rotation to apply varies with time
* (a "moving prime meridian").
*
* <div class="note"><b>Note:</b>
* from some point of view, this scenario is not as weird as it may look like. The Greenwich prime meridian
* was initially the meridian passing through the telescope of the Greenwich observatory. But when a new
* more powerful telescopes was built, is was installed a few metres far from the old one. So if we were
* staying to a strict interpretation like "the meridian passing through the main telescope",
* that meridian would indeed more with time.</div>
*
* @throws FactoryException if an error occurred while creating the conversion.
*/
@Test
@DependsOnMethod("testDefiningConversion")
public void testWithInterpolationCRS() throws FactoryException {
DefaultConversion op = createLongitudeRotation(HardCodedCRS.NTF_NORMALIZED_AXES, createParisCRS(false, HardCodedCS.GEODETIC_2D, true), HardCodedCRS.TIME);
assertMatrixEquals("Longitude rotation of a time-varying CRS", new Matrix4(1, 0, 0, 0, 0, 1, 0, OFFSET, 0, 0, 1, 0, 0, 0, 0, 1), MathTransforms.getMatrix(op.getMathTransform()), STRICT);
op = op.specialize(// In normal use, this would be 'Conversion.class'.
DefaultConversion.class, // Keep the same source CRS.
op.getSourceCRS(), // Swap axis order.
changeCS(op.getTargetCRS(), HardCodedCS.GEODETIC_φλ), DefaultFactories.forBuildin(MathTransformFactory.class));
assertMatrixEquals("Longitude rotation of a time-varying CRS", new Matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, OFFSET, 0, 0, 0, 1), MathTransforms.getMatrix(op.getMathTransform()), STRICT);
}
Aggregations