Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.CoordinateOperation


     */
    @Test
    public void testGeographic3D_ZFirst() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(Z_NAD27);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WGS84_Z);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        assertNotSame(sourceCRS, op.getSourceCRS());
        assertNotSame(targetCRS, op.getTargetCRS());
        assertTrue(op                instanceof Transformation);
        assertTrue(sourceCRS         instanceof CompoundCRS);
        assertTrue(op.getSourceCRS() instanceof GeographicCRS);   // 2D + 1D  --->  3D
        assertTrue(targetCRS         instanceof CompoundCRS);
        assertTrue(op.getTargetCRS() instanceof GeographicCRS);   // 2D + 1D  --->  3D
        assertFalse(sourceCRS.equals(targetCRS));
        assertFalse(op.getSourceCRS().equals(op.getTargetCRS()));
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
        // Note: Expected values below were computed with Geotools (not an external library).
        //       However, it was tested with both Molodenski and Geocentric transformations.
        assertTransformEquals3_3(mt, 0,                    0,                      0,
View Full Code Here


     */
    @Test
    public void test3D_to_2D() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(NAD27_Z);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WKT.WGS84_DMHS);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        if (usingDefaultFactory) {
            assertNotSame(sourceCRS, op.getSourceCRS());
            assertSame   (targetCRS, op.getTargetCRS());
        }
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
        // Note: Expected values below were computed with Geotools (not an external library).
        //       However, it was tested with both Molodenski and Geocentric transformations.
View Full Code Here

     */
    @Test
    public void test3D_to_Z() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(NAD27_Z);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WKT.Z);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        if (usingDefaultFactory) {
            assertSame(sourceCRS, op.getSourceCRS());
            assertSame(targetCRS, op.getTargetCRS());
        }
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
        assertTransformEquals3_1(mt,  00, 0,   0);
        assertTransformEquals3_1(mt,  58, 20, 20);
View Full Code Here

     */
    @Test
    public void test2D_to_3D() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(WKT.NAD27);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WGS84_Z);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        if (usingDefaultFactory) {
            assertSame   (sourceCRS, op.getSourceCRS());
            assertNotSame(targetCRS, op.getTargetCRS());
        }
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
        // Note: Expected values below were computed with Geotools (not an external library).
        //       However, it was tested with both Molodenski and Geocentric transformations.
View Full Code Here

     */
    @Test(expected = OperationNotFoundException.class)
    public void testHtoZ() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(NAD27_H);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(NAD27_Z);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        assertNotSame(sourceCRS, op.getSourceCRS());
        assertNotSame(targetCRS, op.getTargetCRS());
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
    }
View Full Code Here

     */
    @Test(expected = OperationNotFoundException.class)
    public void testHtoH() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(NAD27_H);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WGS84_H);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        assertNotSame(sourceCRS, op.getSourceCRS());
        assertNotSame(targetCRS, op.getTargetCRS());
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
    }
View Full Code Here

     */
    @Test(expected = OperationNotFoundException.class)
    public void test2DtoH() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(WKT.NAD27);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WGS84_H);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        if (usingDefaultFactory) {
            assertSame   (sourceCRS, op.getSourceCRS());
            assertNotSame(targetCRS, op.getTargetCRS());
        }
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
    }
View Full Code Here

     */
    @Test
    public void test3D_to_H() throws Exception {
        final CoordinateReferenceSystem sourceCRS = crsFactory.createFromWKT(NAD27_H);
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WKT.HEIGHT);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        if (usingDefaultFactory) {
            assertSame(sourceCRS, op.getSourceCRS());
            assertSame(targetCRS, op.getTargetCRS());
        }
        assertFalse(mt.isIdentity());
        assertInterfaced(mt);
        assertTransformEquals3_1(mt,  00, 0,   0);
        assertTransformEquals3_1(mt,  58, 20, 20);
View Full Code Here

    public void test4D_to_2D() throws Exception {
        final CoordinateReferenceSystem targetCRS = crsFactory.createFromWKT(WKT.MERCATOR);
        CoordinateReferenceSystem sourceCRS = targetCRS;
        sourceCRS = new DefaultCompoundCRS("Mercator 3D", sourceCRS, DefaultVerticalCRS.ELLIPSOIDAL_HEIGHT);
        sourceCRS = new DefaultCompoundCRS("Mercator 4D", sourceCRS, DefaultTemporalCRS.MODIFIED_JULIAN);
        final CoordinateOperation op = opFactory.createOperation(sourceCRS, targetCRS);
        final MathTransform mt = op.getMathTransform();
        if (usingDefaultFactory) {
            assertSame(sourceCRS, op.getSourceCRS());
            assertSame(targetCRS, op.getTargetCRS());
        }
        assertFalse(mt.isIdentity());
        assertTrue("The somewhat complex MathTransform chain should have been simplified " +
                   "to a single affine transform.", mt instanceof LinearTransform);
        assertTrue("The operation should be a simple axis change, not a complex" +
View Full Code Here

        GeneralEnvelope gridEnvelopeBboxCRS = null;
        if (bboxCRs instanceof GeographicCRS) {
            try {
                CoordinateOperationFactory cof = CRS.getCoordinateOperationFactory(true);

                final CoordinateOperation operation = cof.createOperation(gridEnvelope
                        .getCoordinateReferenceSystem(), bboxCRs);
                gridEnvelopeBboxCRS = CRS.transform(operation, gridEnvelope);
            } catch (Exception e) {
                // this may happen, there is nothing we can do about it, we just
                // use the back transformed envelope to be more lenient about
View Full Code Here

TOP

Related Classes of org.opengis.referencing.operation.CoordinateOperation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.