Package org.eclipse.mosaic.lib.geo
Class GeoUtils
- java.lang.Object
-
- org.eclipse.mosaic.lib.geo.GeoUtils
-
public class GeoUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description GeoUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double
azimuth(CartesianPoint a, CartesianPoint b)
Calculates and returns the angle (azimuth) between two points as seen frompointA
.static double
azimuth(GeoPoint a, GeoPoint b)
Calculates and returns the angle (azimuth) between two points as seen frompointA
.static GeoPoint
closestPointOnLine(GeoPoint point, GeoPoint linePointA, GeoPoint linePointB)
Searches for theMutableGeoPoint
on a line between two given pointslinePointA
andlinePointB
which is closest to the given pointpoint
.static double
distanceBetween(GeoPoint a, GeoPoint b)
static Vector3d
distanceBetween(GeoPoint a, GeoPoint b, Vector3d result)
static GeoPoint
getGeoPointFromDirection(GeoPoint origin, double azimuth, double distance)
Calculates a geographic coordinate based on an origin point and a direction with length.static GeoPoint
getGeoPointFromDirection(GeoPoint origin, Vector3d direction)
static GeoPoint
getPointBetween(GeoPoint pointA, GeoPoint pointB)
Returns the exact point which between the two given points.static long
getQuadKey(GeoPoint geoPoint, int zoom)
Returns the Bing quad key tile with the specified zoom level that contains the givenGeoPoint
.static GeoPoint
getRandomGeoPoint(RandomNumberGenerator random, GeoPoint origin, double radius)
Returns a randomMutableGeoPoint
within the radius of the given point.
-
-
-
Method Detail
-
azimuth
public static double azimuth(GeoPoint a, GeoPoint b)
Calculates and returns the angle (azimuth) between two points as seen frompointA
. The azimuth value starts with0
degrees referring to North, and increases clockwise up to360
degrees.- Parameters:
a
- the base pointb
- the point to calculate the azimuth based onpointA
- 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 frompointA
. The azimuth value starts with0
degrees referring to North, and increases clockwise up to360
degrees.- Parameters:
a
- the base pointb
- the point to calculate the azimuth based onpointA
- 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 theMutableGeoPoint
on a line between two given pointslinePointA
andlinePointB
which is closest to the given pointpoint
.- Parameters:
point
- the point which is used to search for the closest point on the given linelinePointA
- the start of the line on which the resulting point is locatedlinePointB
- the end of the line on which the resulting point is located- Returns:
- the
MutableGeoPoint
on the line betweenlinePointA
andlinePointB
which is closest topoint
-
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 fromazimuth
- The azimuth in decimal degrees from -180° to 180°distance
- The orthodromic distance in the same units as the ellipsoid axis (meters by default)
-
getGeoPointFromDirection
public static GeoPoint getGeoPointFromDirection(GeoPoint origin, Vector3d direction)
-
getRandomGeoPoint
public static GeoPoint getRandomGeoPoint(RandomNumberGenerator random, GeoPoint origin, double radius)
Returns a randomMutableGeoPoint
within the radius of the given point.- Parameters:
random
- the random number generator to generate random pointsorigin
- Initial geographic positionradius
- 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 topointA
orpointB
is equal to the half of the distance betweenpointA
andpointB
.- Parameters:
pointA
- the first pointpointB
- the second point- Returns:
- the point in center of both points
-
-