Package org.geotools.referencing

Examples of org.geotools.referencing.GeodeticCalculator


        Coordinate end = ls.getCoordinateN(1);
        return getGeodeticSegmentLength(start.x, start.y, end.x, end.y);
    }

    private static double getGeodeticSegmentLength(double minx, double miny, double maxx, double maxy) {
        final GeodeticCalculator calculator = new GeodeticCalculator(DefaultGeographicCRS.WGS84);
        double rminx = rollLongitude(minx);
        double rminy = rollLatitude(miny);
        double rmaxx = rollLongitude(maxx);
        double rmaxy = rollLatitude(maxy);
        calculator.setStartingGeographicPoint(rminx, rminy);
        calculator.setDestinationGeographicPoint(rmaxx, rmaxy);
        return calculator.getOrthodromicDistance();
    }
View Full Code Here


        boolean latLon;

        public GeographicGenerator(Point center, int quadrantSegments, CoordinateReferenceSystem crs) {
            this.quadrantSegments = quadrantSegments;
            this.center = center;
            this.calculator = new GeodeticCalculator(crs);
            latLon = isLatLonOrder(crs.getCoordinateSystem());
            if (latLon) {
                calculator.setStartingGeographicPoint(center.getY(), center.getX());
            } else {
                calculator.setStartingGeographicPoint(center.getX(), center.getY());
View Full Code Here

        boolean latLon;

        public GeographicGenerator(Point center, int quadrantSegments, CoordinateReferenceSystem crs) {
            this.quadrantSegments = quadrantSegments;
            this.center = center;
            this.calculator = new GeodeticCalculator(crs);
            latLon = isLatLonOrder(crs.getCoordinateSystem());
            if (latLon) {
                calculator.setStartingGeographicPoint(center.getY(), center.getX());
            } else {
                calculator.setStartingGeographicPoint(center.getX(), center.getY());
View Full Code Here

    setProperty(flow, calculateLength(flow.getGeometry(), crs));
    return flow;
  }
 
  protected double calculateLength(Geometry geometry, CoordinateReferenceSystem crs) {
    GeodeticCalculator geodeticCalculator = new GeodeticCalculator(crs);
   
    Coordinate[] coords = geometry.getCoordinates();

    double totalLength = 0;

    // accumulate the orthodromic distance for every point relation of the given geometry.
    for (int i = 0; i < (coords.length - 1); i++) {
      Coordinate c1 = coords[i];
      Coordinate c2 = coords[i + 1];
      geodeticCalculator.setStartingGeographicPoint(c1.x, c1.y);
      geodeticCalculator.setDestinationGeographicPoint(c2.x, c2.y);
      totalLength += geodeticCalculator.getOrthodromicDistance();
   
   
    return totalLength;
  }
View Full Code Here

TOP

Related Classes of org.geotools.referencing.GeodeticCalculator

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.