Package org.opengis.referencing.operation

Examples of org.opengis.referencing.operation.MathTransform.transform()


                try {
                  BasicFactories commonFactory = BasicFactories.getDefault();
                    CoordinateOperationFactory cof = commonFactory.getCoordinateOperationFactory();
                    CoordinateOperation coordOp = cof.createOperation(pointCRS, myCRS);
                    MathTransform mt = coordOp.getMathTransform();
                    mt.transform(position, copy);
                }
                catch (OperationNotFoundException e) {
                    throw new RuntimeException("Unable to find an operation", e);
                }
                catch (FactoryException e) {
View Full Code Here


        final GridCoverage2DReader reader = sourceRef.get();
        try {
            MathTransform worldToGridTransform =
                    reader.getOriginalGridToWorld(PixelInCell.CELL_CORNER).inverse();

            DirectPosition midPos = worldToGridTransform.transform(pos, null);
            int x = (int) midPos.getOrdinate(0);
            int y = (int) midPos.getOrdinate(1);
            int halfWidth = CACHED_RASTER_WIDTH / 2;

            final Rectangle queryRect = new Rectangle(
View Full Code Here

        assertNotNull(coverage);
    
        // check the footprints have been applied by pocking the output image
        pixel = new byte[4];
        // Close to San Marino, black if we have the insets
        coverage.evaluate(tr.transform(new DirectPosition2D(coverage.getRenderedImage().getMinX(),coverage.getRenderedImage().getMinY()),null), pixel);
//        RenderedImageBrowser.showChain(coverage.getRenderedImage());
        assertEquals(0, pixel[0]);
        assertEquals(0, pixel[1]);
        assertEquals(0, pixel[2]);
        assertEquals(0, pixel[3]);
View Full Code Here

        assertNotNull(coverage);
    
        // check the footprints have been applied by pocking the output image
        pixel = new byte[4];
        // Close to San Marino, black if we have the insets
        coverage.evaluate(tr.transform(new DirectPosition2D(coverage.getRenderedImage().getMinX(),coverage.getRenderedImage().getMinY()),null), pixel);
//        RenderedImageBrowser.showChain(coverage.getRenderedImage());
        assertEquals(0, pixel[0]);
        assertEquals(0, pixel[1]);
        assertEquals(0, pixel[2]);
        assertEquals(0, pixel[3]);
View Full Code Here

             * transform in a more sever way.
             */
            try {
                final MathTransform inv = ctr.inverse();
                Arrays.fill(delta, Math.pow(10, countNonlinear(inv)));
                inv.transform(targetPt, 0, compare,  0, numPts);
                for (int i=0; i<numPts; i++) {
                    if (!isReal(targetPt[i]) || !isReal(compare[i])) {
                        // Ignore all input points that produced NaN or infinity
                        // A succession of 2 "Exponentional" operation produces
                        // infinities pretty fast, so ignore it.
View Full Code Here

         * except for rounding errors. We tolerate maximal error of 0.1 second
         * in longitude or latitude and 1 cm in height.
         */
        final double[] array1 = new double[array0.length];
        final double[] array2 = new double[array0.length];
        transform          .transform(array0, 0, array1, 0, array0.length/dimension);
        transform.inverse().transform(array1, 0, array2, 0, array1.length/dimension);
        assertPointsEqual("transform(Geographic --> Geocentric --> Geographic)", array0, array2,
                          new double[] {0.1/3600, 0.1/3600, 0.01});
        /*
         * Compare the distances between "special" points with expected distances.
View Full Code Here

        final double[] srcPoints = new double[] {300000, 4500000};
        final double[] dstPoints = new double[] {299905.060, 4499796.515};
        final double[] calculatedPoints = new double[srcPoints.length];
       
        // Direct transform test
        mt.transform(srcPoints, 0, calculatedPoints, 0, srcPoints.length/2);
        for (int i=0; i<calculatedPoints.length; i++) {
            assertEquals(dstPoints[i], calculatedPoints[i], precision);
        }

        // Inverse transform test
View Full Code Here

                }
               
                coords[0] = centroid.getX();
                coords[1] = centroid.getY();
                if (tx != null)
                    tx.transform(coords, 0, coords, 0, 1);

                // insert
                ps.setDouble(1, coords[0]);
                ps.setDouble(2, coords[1]);
                ps.setString(3, f.getID());
View Full Code Here

                    src1[1] = southBoundLatitude;

                    double[] src2 = new double[tr.getSourceDimensions()];
                    src2[0] = eastBoundLongitude;
                    src2[1] = northBoundLatitude;
                    tr.transform(src1, 0, dst1, 0, 1);
                    tr.transform(src2, 0, dst2, 0, 1);
                } catch (Exception e1) {
                    e1.printStackTrace();
                    throw new RuntimeException(e1);
                }
View Full Code Here

                    double[] src2 = new double[tr.getSourceDimensions()];
                    src2[0] = eastBoundLongitude;
                    src2[1] = northBoundLatitude;
                    tr.transform(src1, 0, dst1, 0, 1);
                    tr.transform(src2, 0, dst2, 0, 1);
                } catch (Exception e1) {
                    e1.printStackTrace();
                    throw new RuntimeException(e1);
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.