Class GeoUtils


  • public class GeoUtils
    extends Object
    • Constructor Detail

      • GeoUtils

        public GeoUtils()
    • Method Detail

      • distanceBetween

        public static double distanceBetween​(GeoPoint a,
                                             GeoPoint b)
      • azimuth

        public static double azimuth​(GeoPoint a,
                                     GeoPoint b)
        Calculates and returns the angle (azimuth) between two points as seen from pointA. The azimuth value starts with 0 degrees referring to North, and increases clockwise up to 360 degrees.
        Parameters:
        a - the base point
        b - the point to calculate the azimuth based on pointA
        Returns:
        the azimuth value in [degrees] from 0 (North) clockwise to 360
      • azimuth

        public static double azimuth​(CartesianPoint a,
                                     CartesianPoint b)
        Calculates and returns the angle (azimuth) between two points as seen from pointA. The azimuth value starts with 0 degrees referring to North, and increases clockwise up to 360 degrees.
        Parameters:
        a - the base point
        b - the point to calculate the azimuth based on pointA
        Returns:
        the azimuth value in [degrees] from 0 (North) clockwise to 360
      • closestPointOnLine

        public static GeoPoint closestPointOnLine​(GeoPoint point,
                                                  GeoPoint linePointA,
                                                  GeoPoint linePointB)
        Searches for the MutableGeoPoint on a line between two given points linePointA and linePointB which is closest to the given point point.
        Parameters:
        point - the point which is used to search for the closest point on the given line
        linePointA - the start of the line on which the resulting point is located
        linePointB - the end of the line on which the resulting point is located
        Returns:
        the MutableGeoPoint on the line between linePointA and linePointB which is closest to point
      • getGeoPointFromDirection

        public static GeoPoint getGeoPointFromDirection​(GeoPoint origin,
                                                        double azimuth,
                                                        double distance)
        Calculates a geographic coordinate based on an origin point and a direction with length.
        Parameters:
        origin - The geographic position to start from
        azimuth - The azimuth in decimal degrees from -180° to 180°
        distance - The orthodromic distance in the same units as the ellipsoid axis (meters by default)
      • getRandomGeoPoint

        public static GeoPoint getRandomGeoPoint​(RandomNumberGenerator random,
                                                 GeoPoint origin,
                                                 double radius)
        Returns a random MutableGeoPoint within the radius of the given point.
        Parameters:
        random - the random number generator to generate random points
        origin - Initial geographic position
        radius - Radius around the geographic position, unit: [m]
        Returns:
        Random geographic position within the radius of the given point
      • getPointBetween

        public static GeoPoint getPointBetween​(GeoPoint pointA,
                                               GeoPoint pointB)
        Returns the exact point which between the two given points. The orthodromic distance from the resulting point to pointA or pointB is equal to the half of the distance between pointA and pointB.
        Parameters:
        pointA - the first point
        pointB - the second point
        Returns:
        the point in center of both points
      • getQuadKey

        public static long getQuadKey​(GeoPoint geoPoint,
                                      int zoom)
        Returns the Bing quad key tile with the specified zoom level that contains the given GeoPoint.