LatLongUtils class
Utility class for geographic coordinate calculations and geometric operations.
This class provides a comprehensive set of static methods for working with geographic coordinates, including:
- Point-in-polygon testing
- Line segment intersections
- Distance calculations
- Coordinate system conversions
- Geometric analysis of paths and polygons
All methods are static and the class cannot be instantiated.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- CONVERSION_FACTOR → double
-
Conversion factor between degrees and microdegrees (10^6).
final
- DELIMITER → String
-
Standard delimiter for coordinate string parsing.
final
- EQUATORIAL_RADIUS → double
-
WGS84 equatorial radius in meters.
final
- NANO_CONVERSION_FACTOR → double
-
Conversion factor between degrees and nanodegrees (10^9).
final
- POLAR_RADIUS → double
-
WGS84 polar radius in meters.
Used for accurate distance computations on the Earth's ellipsoid.
final
Static Methods
-
combine(
Waypath firstWaypath, List< ILatLong> otherLatLongs) → bool -
adds the
otherLatLongstofirstWaypathin the correct order. Returns true if successful. Note thatfirstWaypathmay be changed whereasotherLatLongsis never gonna be changed. -
contains(
List< ILatLong> latLongs, ILatLong latLong) → bool - Tests if a point lies within a polygon using the ray casting algorithm.
-
degreesToMicrodegrees(
double coordinate) → int - Converts degrees to microdegrees.
-
degreesToNanodegrees(
double coordinate) → int - Converts degrees to nanodegrees.
-
distanceSegmentPoint(
double startX, double startY, double endX, double endY, double pointX, double pointY) → double - Returns the distance between the given segment and point.
-
doesBoundaryIntersectPolygon(
BoundingBox boundary, List< ILatLong> polygon) → bool - Checks if a bounding box (boundary) intersects with a polygon.
-
doLinesIntersect(
ILatLong line1Start, ILatLong line1End, ILatLong line2Start, ILatLong line2End) → bool - Checks if two line segments intersect. They do NOT intersect if the intersection point is outside of the given start-end points.
-
euclideanDistance(
ILatLong latLong1, ILatLong latLong2) → double - Calculates Euclidean distance between two coordinates in degrees.
-
euclideanDistanceSquared(
ILatLong latLong1, ILatLong latLong2) → double -
getLineIntersection(
ILatLong line1Start, ILatLong line1End, ILatLong line2Start, ILatLong line2End) → ILatLong? - Findet den Schnittpunkt von zwei Liniensegmenten.
-
getLineIntersectionHorizontal(
ILatLong line1Start, ILatLong line1End, ILatLong line2Start, ILatLong line2End) → ILatLong? - Finds the intersection point of two line segments whereas the second line segment is horizontal. This is a method which may be faster than the generic one in the case when the first line is above or below the second line.
-
getLineIntersectionVertical(
ILatLong line1Start, ILatLong line1End, ILatLong line2Start, ILatLong line2End) → ILatLong? -
isBoundaryInsidePolygon(
BoundingBox boundary, List< ILatLong> polygon) → bool - Checks if a bounding box is completely contained within a polygon.
-
isClosedWay(
List< ILatLong> latLongs) → bool - Find if this way is closed.
-
isNear(
ILatLong me, ILatLong other) → bool - Returns true if the other point is equal or near this point.
-
isPointInPolygon(
ILatLong point, List< ILatLong> polygon) → bool - Determines if a point is inside or outside a polygon.
-
microdegreesToDegrees(
int coordinate) → double - Converts microdegrees to degrees.
-
nanodegreesToDegrees(
int coordinate) → double - Converts nanodegrees to degrees.
-
nearestSegmentPoint(
double startX, double startY, double endX, double endY, double pointX, double pointY) → LatLong - Returns a point on the segment nearest to the specified point.
-
printLatLongs(
Way way) → void - A convenience method to print a list of lat/long pairs
-
printWaypaths(
Iterable< Waypath> waypaths) → String