Package org.openlr.geo
Class Geo
- java.lang.Object
-
- org.openlr.geo.Geo
-
public class Geo extends Object
A collection of geometric operating on geometry with coordinates in the WGS84 coordinate system.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.locationtech.jts.geom.PolygonapproximateCircle(org.locationtech.jts.geom.Coordinate center, double radius)Create a polygon geometry that approximates a circle.org.locationtech.jts.geom.PolygonapproximateCircle(org.locationtech.jts.geom.Coordinate center, double radius, int numberOfPoints)Create a polygon geometry that approximates a circle.doublecalculateBearing(org.locationtech.jts.geom.Coordinate from, org.locationtech.jts.geom.Coordinate to)Calculate the bearing angle between a pair of coordinates.doublecalculateBearing(org.locationtech.jts.geom.Point from, org.locationtech.jts.geom.Point to)Calculate the bearing angle between a pair of points.doublecalculateBearingDifference(double bearingA, double bearingB)Calculate the absolute angle difference in degrees between a pair of bearing angles.org.locationtech.jts.geom.CoordinatecalculateCoordinateAlongLineString(org.locationtech.jts.geom.LineString lineString, double fraction)Calculate the coordinate along a line string at a certain fraction of the line string's length.doublecalculateDistance(org.locationtech.jts.geom.Coordinate coordinateA, org.locationtech.jts.geom.Coordinate coordinateB)Calculate the distance in meters between a pair of coordinates.doublecalculateDistance(org.locationtech.jts.geom.Point pointA, org.locationtech.jts.geom.Point pointB)Calculate the distance in meters between a pair of points.org.locationtech.jts.geom.PointcalculatePointAlongLineString(org.locationtech.jts.geom.LineString lineString, double fraction)Calculate the point along a line string at a certain fraction of the line string's length.org.locationtech.jts.geom.LineStringjoinLineStrings(List<org.locationtech.jts.geom.LineString> lineStrings)Join a sequence of line strings together to form a single line string.doubleprojectOnLineString(org.locationtech.jts.geom.Coordinate coordinate, org.locationtech.jts.geom.LineString lineString)Project a coordinate onto a line string and return fraction along the line string from the start where the projection point is found.org.locationtech.jts.geom.LineStringsliceLineString(org.locationtech.jts.geom.LineString lineString, double startFraction, double stopFraction)Create a slice of a line string that begins at a start fraction and ends at a stop fraction of the line string's length.
-
-
-
Method Detail
-
calculateDistance
public double calculateDistance(org.locationtech.jts.geom.Coordinate coordinateA, org.locationtech.jts.geom.Coordinate coordinateB)Calculate the distance in meters between a pair of coordinates.- Parameters:
coordinateA- the first coordinatecoordinateB- the second coordinate- Returns:
- the distance in meters between the coordinate pair
-
calculateDistance
public double calculateDistance(org.locationtech.jts.geom.Point pointA, org.locationtech.jts.geom.Point pointB)Calculate the distance in meters between a pair of points.- Parameters:
pointA- the first pointpointB- the second point- Returns:
- the distance in meters between the point pair
-
calculateBearing
public double calculateBearing(org.locationtech.jts.geom.Coordinate from, org.locationtech.jts.geom.Coordinate to)Calculate the bearing angle between a pair of coordinates. The angle is returned in degrees0° >= angle < 360°and is the angle in a clockwise direction relative to due north.- Parameters:
from- the origin coordinateto- the destination coordinate- Returns:
- the bearing angle from origin to destination
-
calculateBearing
public double calculateBearing(org.locationtech.jts.geom.Point from, org.locationtech.jts.geom.Point to)Calculate the bearing angle between a pair of points. The angle is returned in degrees0° >= angle < 360°and is the angle in a clockwise direction relative to due north.- Parameters:
from- the origin pointto- the destination point- Returns:
- the bearing angle from origin to destination
-
calculateBearingDifference
public double calculateBearingDifference(double bearingA, double bearingB)Calculate the absolute angle difference in degrees between a pair of bearing angles. The angle is returned in degrees0° >= angle < 180°.- Parameters:
bearingA- the first bearing anglebearingB- the second bearing angle- Returns:
- the difference between the pair of angles
-
projectOnLineString
public double projectOnLineString(org.locationtech.jts.geom.Coordinate coordinate, org.locationtech.jts.geom.LineString lineString)Project a coordinate onto a line string and return fraction along the line string from the start where the projection point is found.- Parameters:
coordinate- the coordinate to projectlineString- the line string to project onto- Returns:
- the fraction along the line string where the projection point is found
-
calculateCoordinateAlongLineString
public org.locationtech.jts.geom.Coordinate calculateCoordinateAlongLineString(org.locationtech.jts.geom.LineString lineString, double fraction)Calculate the coordinate along a line string at a certain fraction of the line string's length.- Parameters:
lineString- the line stringfraction- the fraction along the line string- Returns:
- the coordinate at this fraction
-
calculatePointAlongLineString
public org.locationtech.jts.geom.Point calculatePointAlongLineString(org.locationtech.jts.geom.LineString lineString, double fraction)Calculate the point along a line string at a certain fraction of the line string's length.- Parameters:
lineString- the line stringfraction- the fraction along the line string- Returns:
- the point at this fraction
-
joinLineStrings
public org.locationtech.jts.geom.LineString joinLineStrings(List<org.locationtech.jts.geom.LineString> lineStrings)
Join a sequence of line strings together to form a single line string. The line strings must be connected ie. the start point of any line string must be the same as the end point of the preceding line string.- Parameters:
lineStrings- a sequence of line strings- Returns:
- the concatenation of the line strings
-
sliceLineString
public org.locationtech.jts.geom.LineString sliceLineString(org.locationtech.jts.geom.LineString lineString, double startFraction, double stopFraction)Create a slice of a line string that begins at a start fraction and ends at a stop fraction of the line string's length.- Parameters:
lineString- the line string to slicestartFraction- the fraction along the line string where the slice beginsstopFraction- the fraction along the line string where the slice ends- Returns:
- the slice of the line string
-
approximateCircle
public org.locationtech.jts.geom.Polygon approximateCircle(org.locationtech.jts.geom.Coordinate center, double radius)Create a polygon geometry that approximates a circle.- Parameters:
center- the center point of the circleradius- the radius of the circle in meters- Returns:
- a polygon that approximates the circle geometry
-
approximateCircle
public org.locationtech.jts.geom.Polygon approximateCircle(org.locationtech.jts.geom.Coordinate center, double radius, int numberOfPoints)Create a polygon geometry that approximates a circle. The number of points in the resulting polygon shell is provided. This controls the accuracy of the approximation.- Parameters:
center- the center point of the circleradius- the radius of the circle in metersnumberOfPoints- the number of points in the polygon shell- Returns:
- a polygon that approximates the circle geometry
-
-