Package org.geotools.geometry

Examples of org.geotools.geometry.GeneralDirectPosition


                unit.cartesianLocation = new CartesianLocation(eastings, northings);

                final TimerContext latLongCtx = latLongTransform.time();
                try {
                    DirectPosition eastNorth = new GeneralDirectPosition(eastings, northings);
                    DirectPosition latLng = osgbToWgs84Transform.transform(eastNorth, eastNorth);

                    unit.location = new Location(round(latLng.getOrdinate(1), 8), round(latLng.getOrdinate(0), 8));
                } finally {
                    latLongCtx.stop();
View Full Code Here


        MathTransform transform = CRS.findMathTransform(BC_ALBERS, WGS84);
        DirectPosition here = new DirectPosition2D(BC_ALBERS, 1187128, 395268);
        DirectPosition there = new DirectPosition2D(WGS84, -123.47009173007372, 48.54326498732153);

        DirectPosition check = transform.transform(here, new GeneralDirectPosition(WGS84));
        double delta = Math.abs(check.getOrdinate(0) - there.getOrdinate(0))
                + Math.abs(check.getOrdinate(1) - there.getOrdinate(1));
        if (delta > 0.0001) {
            String msg = "Referencing failed to transformation with expected accuracy: Off by " + delta + "\n" + check + "\n" + there; //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
            System.out.println(msg);
View Full Code Here

        for( int t = 0; t < npoints; t++ ){
            double dx = scaleX * t;
            double dy = scaleY * t;
           
            GeneralDirectPosition left = new GeneralDirectPosition( xmin, ymin+dy);
            DirectPosition pt = transformTo3D( left, transform1, transform2 );
            targetEnvelope.expandToInclude(pt);
           
            GeneralDirectPosition top = new GeneralDirectPosition( xmin+dx, ymax);
            pt = transformTo3D( top, transform1, transform2 );
            targetEnvelope.expandToInclude(pt);
           
            GeneralDirectPosition right = new GeneralDirectPosition( xmax, ymax-dy);
            pt = transformTo3D( right, transform1, transform2 );
            targetEnvelope.expandToInclude(pt);
           
            GeneralDirectPosition bottom = new GeneralDirectPosition( xmax-dx, ymin);
            pt = transformTo3D( bottom, transform1, transform2 );
            targetEnvelope.expandToInclude(pt);
        }
        return targetEnvelope;
    }
View Full Code Here

            double dy = scaleY * t;
            for( int u = 0; u < npoints; u++ ){
                double dz = scaleZ * u;
                double z = zmin+dz;

                GeneralDirectPosition left = new GeneralDirectPosition(xmin, ymin+dy, z );
               
                DirectPosition pt = transformTo2D( left, transform1, transform2 );
                targetEnvelope.expandToInclude(pt);
               
                GeneralDirectPosition top = new GeneralDirectPosition( xmin+dx, ymax, z );
                pt = transformTo2D( top, transform1, transform2 );
                targetEnvelope.expandToInclude(pt);
               
                GeneralDirectPosition right = new GeneralDirectPosition( xmax, ymax-dy, z);
                pt = transformTo2D( right, transform1, transform2 );
                targetEnvelope.expandToInclude(pt);
               
                GeneralDirectPosition bottom = new GeneralDirectPosition( xmax-dx, ymax, z);
                pt = transformTo2D( bottom, transform1, transform2 );
                targetEnvelope.expandToInclude(pt);
               
                if (zmin == zmax) {
                    break; // only need one z sample
View Full Code Here

     */
    private static DirectPosition transformTo3D(GeneralDirectPosition srcPosition, MathTransform transformToWGS84,
            MathTransform transformFromWGS84_3D) throws TransformException {
        DirectPosition world2D = transformToWGS84.transform(srcPosition, null );
       
        DirectPosition world3D = new GeneralDirectPosition( DefaultGeographicCRS.WGS84_3D);
        world3D.setOrdinate(0, world2D.getOrdinate(0));
        world3D.setOrdinate(1, world2D.getOrdinate(1));
        world3D.setOrdinate(2, 0.0 ); // 0 elliposial height is assumed
       
        DirectPosition targetPosition = transformFromWGS84_3D.transform(world3D, null );
        return targetPosition;
    }
View Full Code Here

        if( Double.isNaN( srcPosition.getOrdinate(2)) ){
            srcPosition.setOrdinate(2, 0.0 ); // lazy add 3rd ordinate if not provided to prevent failure
        }
        DirectPosition world3D = transformToWGS84_3D.transform(srcPosition, null );
       
        DirectPosition world2D = new GeneralDirectPosition( DefaultGeographicCRS.WGS84);
        world2D.setOrdinate(0, world3D.getOrdinate(0));
        world2D.setOrdinate(1, world3D.getOrdinate(1));
       
        DirectPosition targetPosition = transformFromWGS84.transform(world2D, null );
        return targetPosition;
    }
View Full Code Here

            gc = new GeodeticCalculator(crs);
            CALCULATORS.put(crs, gc);
        }
        assert crs.equals(gc.getCoordinateReferenceSystem()) : crs;

        final GeneralDirectPosition pos = POSITIONS[Math.min(POSITIONS.length - 1, crs
                .getCoordinateSystem().getDimension())];
        pos.setCoordinateReferenceSystem(crs);
        copy(p1, pos.ordinates);
        gc.setStartingPosition(pos);
        copy(p2, pos.ordinates);
        gc.setDestinationPosition(pos);
View Full Code Here

            Node timePositionNodeBegin = timePositions.get(0);
            Node timePositionNodeEnd = timePositions.get(1);
            minCP[minCP.length - 1] = TCRS.toValue(((DefaultPosition)timePositionNodeBegin.getValue()).getDate());
            maxCP[maxCP.length - 1] = TCRS.toValue(((DefaultPosition)timePositionNodeEnd.getValue()).getDate());

            GeneralDirectPosition minDP = new GeneralDirectPosition(minCP);
            minDP.setCoordinateReferenceSystem(crs);
            GeneralDirectPosition maxDP = new GeneralDirectPosition(maxCP);
            maxDP.setCoordinateReferenceSystem(crs);

            GeneralEnvelope envelopeWithTime = new GeneralEnvelope(minDP, maxDP);

            return envelopeWithTime;
        }
View Full Code Here

            int c = 0;
            for (String coord : CP) {
                coordinates[c++] = Double.parseDouble(coord.trim());
            }

            dp = new GeneralDirectPosition(coordinates);
        }

        return dp;
    }
View Full Code Here

            Node timePositionNodeBegin = timePositions.get(0);
            Node timePositionNodeEnd = timePositions.get(1);
            minCP[minCP.length - 1] = TCRS.toValue(((DefaultPosition)timePositionNodeBegin.getValue()).getDate());
            maxCP[maxCP.length - 1] = TCRS.toValue(((DefaultPosition)timePositionNodeEnd.getValue()).getDate());

            GeneralDirectPosition minDP = new GeneralDirectPosition(minCP);
                                  minDP.setCoordinateReferenceSystem(crs);
            GeneralDirectPosition maxDP = new GeneralDirectPosition(maxCP);
                                  maxDP.setCoordinateReferenceSystem(crs);

            GeneralEnvelope envelopeWithTime = new GeneralEnvelope(minDP, maxDP);

            return envelopeWithTime;
        }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.GeneralDirectPosition

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.