Class GeoUtils


  • public class GeoUtils
    extends Object
    Author:
    Larry
    • Constructor Summary

      Constructors 
      Constructor Description
      GeoUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static org.locationtech.jts.geom.Coordinate along​(double d, org.locationtech.jts.geom.Coordinate q, org.locationtech.jts.geom.Coordinate r)  
      static boolean clockwise​(org.locationtech.jts.geom.Geometry geo)  
      static org.locationtech.jts.geom.CoordinateList ConvexHullWrap​(org.locationtech.jts.geom.CoordinateList coords)  
      static org.locationtech.jts.geom.Geometry createPlume​(org.locationtech.jts.geom.Coordinate[] coords, double radius1, double radius2)
      Generate a plume Polygon using Coordinate[] bounded on each end by circles of radius1 and radius2.
      static double distance​(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2)  
      static double dot​(org.locationtech.jts.geom.Coordinate p, org.locationtech.jts.geom.Coordinate q)  
      static boolean geometriesEqual​(org.locationtech.jts.geom.Geometry geo1, org.locationtech.jts.geom.Geometry geo2)  
      static boolean geometryIsSegmentOf​(org.locationtech.jts.geom.Geometry geo1, org.locationtech.jts.geom.Geometry geo2)  
      static double getBearing180​(org.locationtech.jts.geom.Coordinate startPt, org.locationtech.jts.geom.Coordinate endPt)  
      static double getBearing360​(org.locationtech.jts.geom.Coordinate startPt, org.locationtech.jts.geom.Coordinate endPt)  
      static double getBearingRadians​(org.locationtech.jts.geom.Coordinate startPt, org.locationtech.jts.geom.Coordinate endPt)  
      static org.locationtech.jts.geom.Coordinate getCenter​(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)  
      static org.locationtech.jts.geom.Coordinate getClosestPointOnLine​(org.locationtech.jts.geom.Coordinate pt, org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)  
      static org.locationtech.jts.geom.Coordinate getClosestPointOnSegment​(org.locationtech.jts.geom.Coordinate pt, org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)  
      static double getDistance​(org.locationtech.jts.geom.Coordinate pt, org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1)  
      static org.locationtech.jts.geom.Coordinate[] getDistanceAngleArray​(org.locationtech.jts.geom.LineString ring)  
      static org.locationtech.jts.geom.Coordinate[] getDistanceBearingArray​(org.locationtech.jts.geom.LineString ring)  
      static double getDistanceFromPointToGeometry​(org.locationtech.jts.geom.Coordinate coord, org.locationtech.jts.geom.Geometry geo)  
      static org.locationtech.jts.geom.Coordinate getIntersection​(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3, org.locationtech.jts.geom.Coordinate p4)  
      static double interiorAngle​(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2, org.locationtech.jts.geom.Coordinate p3)  
      static org.locationtech.jts.geom.Coordinate intersect​(org.locationtech.jts.geom.Coordinate P1, org.locationtech.jts.geom.Coordinate P2, org.locationtech.jts.geom.Coordinate P3, org.locationtech.jts.geom.Coordinate P4)  
      static org.locationtech.jts.geom.Coordinate intersectSegments​(org.locationtech.jts.geom.Coordinate P1, org.locationtech.jts.geom.Coordinate P2, org.locationtech.jts.geom.Coordinate P3, org.locationtech.jts.geom.Coordinate P4)  
      static double mag​(org.locationtech.jts.geom.Coordinate q)  
      static org.locationtech.jts.geom.LineString MakeRoundCorner​(org.locationtech.jts.geom.Coordinate A, org.locationtech.jts.geom.Coordinate B, org.locationtech.jts.geom.Coordinate C, org.locationtech.jts.geom.Coordinate D, double r, boolean arcOnly)  
      static org.locationtech.jts.geom.Coordinate perpendicularVector​(org.locationtech.jts.geom.Coordinate v1, org.locationtech.jts.geom.Coordinate v2, double dist, boolean toLeft)  
      static boolean pointToRight​(org.locationtech.jts.geom.Coordinate pt, org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2)  
      static org.locationtech.jts.geom.Geometry reducePoints​(org.locationtech.jts.geom.Geometry geo, double tolerance)  
      static org.locationtech.jts.geom.LinearRing removeRedundantPoints​(org.locationtech.jts.geom.LineString ring)  
      static org.locationtech.jts.geom.Coordinate rotPt​(org.locationtech.jts.geom.Coordinate inpt, org.locationtech.jts.geom.Coordinate rpt, double theta)  
      static BitSet setBit​(BitSet bitSet, org.locationtech.jts.geom.Geometry geometry)  
      static org.locationtech.jts.geom.Polygon taperedBufferSegment​(org.locationtech.jts.geom.Coordinate p0, org.locationtech.jts.geom.Coordinate p1, double d1, double d2)  
      static double theta​(org.locationtech.jts.geom.Coordinate p1, org.locationtech.jts.geom.Coordinate p2)  
      static org.locationtech.jts.geom.Coordinate unitVec​(org.locationtech.jts.geom.Coordinate q)  
      static org.locationtech.jts.geom.Coordinate vectorAdd​(org.locationtech.jts.geom.Coordinate q, org.locationtech.jts.geom.Coordinate r)  
      static org.locationtech.jts.geom.Coordinate vectorBetween​(org.locationtech.jts.geom.Coordinate q, org.locationtech.jts.geom.Coordinate r)  
      static org.locationtech.jts.geom.Coordinate vectorTimesScalar​(org.locationtech.jts.geom.Coordinate q, double m)  
    • Constructor Detail

      • GeoUtils

        public GeoUtils()
    • Method Detail

      • mag

        public static double mag​(org.locationtech.jts.geom.Coordinate q)
      • distance

        public static double distance​(org.locationtech.jts.geom.Coordinate p1,
                                      org.locationtech.jts.geom.Coordinate p2)
      • unitVec

        public static org.locationtech.jts.geom.Coordinate unitVec​(org.locationtech.jts.geom.Coordinate q)
      • vectorAdd

        public static org.locationtech.jts.geom.Coordinate vectorAdd​(org.locationtech.jts.geom.Coordinate q,
                                                                     org.locationtech.jts.geom.Coordinate r)
      • vectorBetween

        public static org.locationtech.jts.geom.Coordinate vectorBetween​(org.locationtech.jts.geom.Coordinate q,
                                                                         org.locationtech.jts.geom.Coordinate r)
      • vectorTimesScalar

        public static org.locationtech.jts.geom.Coordinate vectorTimesScalar​(org.locationtech.jts.geom.Coordinate q,
                                                                             double m)
      • dot

        public static double dot​(org.locationtech.jts.geom.Coordinate p,
                                 org.locationtech.jts.geom.Coordinate q)
      • rotPt

        public static org.locationtech.jts.geom.Coordinate rotPt​(org.locationtech.jts.geom.Coordinate inpt,
                                                                 org.locationtech.jts.geom.Coordinate rpt,
                                                                 double theta)
      • pointToRight

        public static boolean pointToRight​(org.locationtech.jts.geom.Coordinate pt,
                                           org.locationtech.jts.geom.Coordinate p1,
                                           org.locationtech.jts.geom.Coordinate p2)
      • perpendicularVector

        public static org.locationtech.jts.geom.Coordinate perpendicularVector​(org.locationtech.jts.geom.Coordinate v1,
                                                                               org.locationtech.jts.geom.Coordinate v2,
                                                                               double dist,
                                                                               boolean toLeft)
      • getBearing180

        public static double getBearing180​(org.locationtech.jts.geom.Coordinate startPt,
                                           org.locationtech.jts.geom.Coordinate endPt)
      • getBearingRadians

        public static double getBearingRadians​(org.locationtech.jts.geom.Coordinate startPt,
                                               org.locationtech.jts.geom.Coordinate endPt)
      • getBearing360

        public static double getBearing360​(org.locationtech.jts.geom.Coordinate startPt,
                                           org.locationtech.jts.geom.Coordinate endPt)
      • theta

        public static double theta​(org.locationtech.jts.geom.Coordinate p1,
                                   org.locationtech.jts.geom.Coordinate p2)
      • ConvexHullWrap

        public static org.locationtech.jts.geom.CoordinateList ConvexHullWrap​(org.locationtech.jts.geom.CoordinateList coords)
      • getDistance

        public static double getDistance​(org.locationtech.jts.geom.Coordinate pt,
                                         org.locationtech.jts.geom.Coordinate p0,
                                         org.locationtech.jts.geom.Coordinate p1)
      • getClosestPointOnSegment

        public static org.locationtech.jts.geom.Coordinate getClosestPointOnSegment​(org.locationtech.jts.geom.Coordinate pt,
                                                                                    org.locationtech.jts.geom.Coordinate p0,
                                                                                    org.locationtech.jts.geom.Coordinate p1)
      • getClosestPointOnLine

        public static org.locationtech.jts.geom.Coordinate getClosestPointOnLine​(org.locationtech.jts.geom.Coordinate pt,
                                                                                 org.locationtech.jts.geom.Coordinate p0,
                                                                                 org.locationtech.jts.geom.Coordinate p1)
      • along

        public static org.locationtech.jts.geom.Coordinate along​(double d,
                                                                 org.locationtech.jts.geom.Coordinate q,
                                                                 org.locationtech.jts.geom.Coordinate r)
      • interiorAngle

        public static double interiorAngle​(org.locationtech.jts.geom.Coordinate p1,
                                           org.locationtech.jts.geom.Coordinate p2,
                                           org.locationtech.jts.geom.Coordinate p3)
      • getDistanceBearingArray

        public static org.locationtech.jts.geom.Coordinate[] getDistanceBearingArray​(org.locationtech.jts.geom.LineString ring)
        Parameters:
        ring - - LinearRing represented as LineString to analyze
        Returns:
        - Coordinate[] with first point of passed LineString in [0] followed by [1-length] with x as distance and y as angle. The angle will be the will be the absolute bearing in the range 0-360. The original LineString and Coordinate points are unmodified.
      • getDistanceAngleArray

        public static org.locationtech.jts.geom.Coordinate[] getDistanceAngleArray​(org.locationtech.jts.geom.LineString ring)
        Parameters:
        ring - - LinearRing represented as LineString to analyze
        Returns:
        - Coordinate[] array of with x as distance and y as interior angles in degrees 0 to +180. The angles at each index in the array are the interior angles at the vertex position in the (closed polygon) ring. Every array position if filled. The distances are the distance at a vertex to the following point. For [n-2] the distance is computed to the [n-1] position assuming the ring is closed.
      • removeRedundantPoints

        public static org.locationtech.jts.geom.LinearRing removeRedundantPoints​(org.locationtech.jts.geom.LineString ring)
        Parameters:
        ring - - a LineString representing a linear ring
        Returns:
        - an array of Coordinate points with colinear points removed. The original LineString and Coordinate points are unmodified.
      • reducePoints

        public static org.locationtech.jts.geom.Geometry reducePoints​(org.locationtech.jts.geom.Geometry geo,
                                                                      double tolerance)
      • clockwise

        public static boolean clockwise​(org.locationtech.jts.geom.Geometry geo)
      • intersect

        public static org.locationtech.jts.geom.Coordinate intersect​(org.locationtech.jts.geom.Coordinate P1,
                                                                     org.locationtech.jts.geom.Coordinate P2,
                                                                     org.locationtech.jts.geom.Coordinate P3,
                                                                     org.locationtech.jts.geom.Coordinate P4)
      • getIntersection

        public static org.locationtech.jts.geom.Coordinate getIntersection​(org.locationtech.jts.geom.Coordinate p1,
                                                                           org.locationtech.jts.geom.Coordinate p2,
                                                                           org.locationtech.jts.geom.Coordinate p3,
                                                                           org.locationtech.jts.geom.Coordinate p4)
      • intersectSegments

        public static org.locationtech.jts.geom.Coordinate intersectSegments​(org.locationtech.jts.geom.Coordinate P1,
                                                                             org.locationtech.jts.geom.Coordinate P2,
                                                                             org.locationtech.jts.geom.Coordinate P3,
                                                                             org.locationtech.jts.geom.Coordinate P4)
      • getCenter

        public static org.locationtech.jts.geom.Coordinate getCenter​(org.locationtech.jts.geom.Coordinate p1,
                                                                     org.locationtech.jts.geom.Coordinate p2,
                                                                     org.locationtech.jts.geom.Coordinate p3)
      • setBit

        public static BitSet setBit​(BitSet bitSet,
                                    org.locationtech.jts.geom.Geometry geometry)
      • MakeRoundCorner

        public static org.locationtech.jts.geom.LineString MakeRoundCorner​(org.locationtech.jts.geom.Coordinate A,
                                                                           org.locationtech.jts.geom.Coordinate B,
                                                                           org.locationtech.jts.geom.Coordinate C,
                                                                           org.locationtech.jts.geom.Coordinate D,
                                                                           double r,
                                                                           boolean arcOnly)
      • geometriesEqual

        public static boolean geometriesEqual​(org.locationtech.jts.geom.Geometry geo1,
                                              org.locationtech.jts.geom.Geometry geo2)
      • getDistanceFromPointToGeometry

        public static double getDistanceFromPointToGeometry​(org.locationtech.jts.geom.Coordinate coord,
                                                            org.locationtech.jts.geom.Geometry geo)
      • geometryIsSegmentOf

        public static boolean geometryIsSegmentOf​(org.locationtech.jts.geom.Geometry geo1,
                                                  org.locationtech.jts.geom.Geometry geo2)
      • createPlume

        public static org.locationtech.jts.geom.Geometry createPlume​(org.locationtech.jts.geom.Coordinate[] coords,
                                                                     double radius1,
                                                                     double radius2)
        Generate a plume Polygon using Coordinate[] bounded on each end by circles of radius1 and radius2.
        Parameters:
        coords - - Coordinate[] sequence of points derived from a LineString.
        radius1 - - the radius around the first point in coords.
        radius2 - - the radius around the last point in coords.
        Returns:
        Geometry containing Polygon of plume.
      • taperedBufferSegment

        public static org.locationtech.jts.geom.Polygon taperedBufferSegment​(org.locationtech.jts.geom.Coordinate p0,
                                                                             org.locationtech.jts.geom.Coordinate p1,
                                                                             double d1,
                                                                             double d2)