Package org.geotools.geometry

Examples of org.geotools.geometry.DirectPosition2D


            double south= bounds.getMinY();
            double north= bounds.getMaxY();
            if (destinationCRS != null) {
                env = new ReferencedEnvelope(west, east, south, north, destinationCRS);
            } else {
                DirectPosition2D minDp = new DirectPosition2D(west, south);
                DirectPosition2D maxDp = new DirectPosition2D(east, north);
                env = new Envelope2D(minDp, maxDp);
            }
            readGridGeometry2DParam.setValue(new GridGeometry2D(gridEnvelope, env));

             currentContext.setStatus(ILayer.WORKING);
View Full Code Here


                    final GeneralParameterValue[] parameters = CoverageUtils.getParameters(params, requestedLayers[i].getCoverage().getParameters(),true);
                    //get the original grid geometry
                    final GridGeometry2D coverageGeometry=(GridGeometry2D) cinfo.getGrid();
                    // set the requested position in model space for this request
                    final Coordinate middle = pixelToWorld(x, y, bbox, width, height);
                    DirectPosition position = new DirectPosition2D(requestedCRS, middle.x, middle.y);
                 
                  //change from request crs to coverage crs in order to compute a minimal request area,
                    // TODO this code need to be made much more robust
                    if (requestedCRS != null) {
                       
View Full Code Here

            DistanceUnit ellipsoidUnit = DistanceUnit.fromString(calc.getEllipsoid().getAxisUnit().toString());
            double geoWidth = DistanceUnit.IN.convertTo(geoWidthInInches, ellipsoidUnit);
            double geoHeight = DistanceUnit.IN.convertTo(geoHeightInInches, ellipsoidUnit);

            DirectPosition2D directPosition2D = new DirectPosition2D(this.center.x, this.center.y);
            directPosition2D.setCoordinateReferenceSystem(crs);
            calc.setStartingPosition(directPosition2D);

            final int west = -90;
            calc.setDirection(west, geoWidth / 2.0);
            double minGeoX =  calc.getDestinationPosition().getOrdinate(0);
View Full Code Here

                double y = Double.parseDouble(reader.get(yCol));
                double x = Double.parseDouble(reader.get(xCol));

                double lon, lat;
                if (transform) {
                    DirectPosition2D orig = new DirectPosition2D(x, y);
                    DirectPosition2D transformed = new DirectPosition2D();
                    mathTransform.transform(orig, transformed);

                    // x: lat, y: lon. This seems backwards but is the way Geotools does it.
                    if (latLon) {
                        lon = transformed.getY();
                        lat = transformed.getX()
                    }
                    // x: lon, y: lat
                    else {
                        lon = transformed.getX();
                        lat = transformed.getY();
                    }
                }                 
                else {
                    lon = x;
                    lat = y;
View Full Code Here

     * @return elevation in meters
     */
    private double getElevation(double x, double y) {
        double values[] = new double[1];
        try {
            coverage.evaluate(new DirectPosition2D(x, y), values);
        } catch (org.opengis.coverage.PointOutsideCoverageException e) {
            // skip this for now
        }
        return values[0];
    }
View Full Code Here

                    CoordinateReferenceSystem crs2 = acquireCRS(code2);

                    // reproject
                    MathTransform transform = CRS.findMathTransform(crs1, crs2,
                            true);
                    DirectPosition pos = new DirectPosition2D(48.417, 123.35);
                    try {
                        transform.transform(pos, null);
                    } catch (Exception e) {
                        // chomp
                    }
View Full Code Here

    /**
     * A coordinate position consisting of all the minimal ordinates for each
     * dimension for all points within the {@code Envelope}.
     */
    public DirectPosition getLowerCorner() {
        return new DirectPosition2D(crs, getMinX(), getMinY());
    }
View Full Code Here

    /**
     * A coordinate position consisting of all the maximal ordinates for each
     * dimension for all points within the {@code Envelope}.
     */
    public DirectPosition getUpperCorner() {
        return new DirectPosition2D(crs, getMaxX(), getMaxY());
    }
View Full Code Here

                    CoordinateReferenceSystem crs2 = acquireCRS(code2);

                    // reproject
                    MathTransform transform = CRS.findMathTransform(crs1, crs2,
                            true);
                    DirectPosition pos = new DirectPosition2D(48.417, 123.35);
                    try {
                        transform.transform(pos, null);
                    } catch (Exception e) {
                        // chomp
                    }
View Full Code Here

        double y;

        for (int i = 0; i < dps.length; i++) {
            x = coordinates.getOrdinate(i, 0);
            y = coordinates.getOrdinate(i, 1);
            dps[i] = new DirectPosition2D(x, y);
        }

        return dps;
    }
View Full Code Here

TOP

Related Classes of org.geotools.geometry.DirectPosition2D

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.