-
public final class LatLngKt
-
-
Method Summary
Modifier and Type Method Description final static Doublecomponent1(LatLng $self)Returns the LatLng.latitude of this LatLng. final static Doublecomponent2(LatLng $self)Returns the LatLng.longitude of this LatLng. final static BooleanisLocationOnPath(List<LatLng> $self, LatLng latLng, Boolean geodesic, Double tolerance)Computes whether the given latLng lies on or is near this polyline within tolerance (in meters). final static BooleanisOnEdge(List<LatLng> $self, LatLng latLng, Boolean geodesic, Double tolerance)Checks whether or not latLng lies on or is near the edge of this polygon within the tolerance (in meters). final static BooleancontainsLocation(List<LatLng> $self, LatLng latLng, Boolean geodesic)Computes whether the latLng lies inside this. final static List<LatLng>simplify(List<LatLng> $self, Double tolerance)Simplifies this list of LatLng using the Douglas-Peucker decimation. final static List<LatLng>toLatLngList(String $self)Decodes this encoded string into a LatLng list. final static StringlatLngListEncode(List<LatLng> $self)Encodes this LatLng list in a String using the Polyline Algorithm Format. final static BooleanisClosedPolygon(List<LatLng> $self)Checks whether or not this LatLng list is a closed Polygon. final static DoublesphericalPathLength(List<LatLng> $self)Computes the length of this path on Earth. final static DoublesphericalPolygonArea(List<LatLng> $self)Computes the area under a closed path on Earth. final static DoublesphericalPolygonSignedArea(List<LatLng> $self)Computes the signed area under a closed path on Earth. final static DoublesphericalHeading(LatLng $self, LatLng toLatLng)Computes the heading from this LatLng to toLatLng. final static LatLngwithSphericalOffset(LatLng $self, Double distance, Double heading)Offsets this LatLng from the provided distance and heading and returns the result. final static LatLngcomputeSphericalOffsetOrigin(LatLng $self, Double distance, Double heading)Attempts to compute the origin LatLng from this LatLng where distance meters have been traveled with heading value heading. final static LatLngwithSphericalLinearInterpolation(LatLng $self, LatLng to, Double fraction)Returns an interpolated LatLng between this LatLng and to by the provided fractional value fraction. final static DoublesphericalDistance(LatLng $self, LatLng to)Computes the spherical distance between this LatLng and to. -
-
Method Detail
-
component1
final static Double component1(LatLng $self)
Returns the LatLng.latitude of this LatLng.
e.g.
val (lat, _) = latLng
-
component2
final static Double component2(LatLng $self)
Returns the LatLng.longitude of this LatLng.
e.g.
val (_, lng) = latLng
-
isLocationOnPath
final static Boolean isLocationOnPath(List<LatLng> $self, LatLng latLng, Boolean geodesic, Double tolerance)
Computes whether the given latLng lies on or is near this polyline within tolerance (in meters).
- Parameters:
latLng- the LatLng to inspectgeodesic- if this polyline is geodesic or nottolerance- the tolerance in meters
-
isOnEdge
final static Boolean isOnEdge(List<LatLng> $self, LatLng latLng, Boolean geodesic, Double tolerance)
Checks whether or not latLng lies on or is near the edge of this polygon within the tolerance (in meters). The default value is PolyUtil.DEFAULT_TOLERANCE.
- Parameters:
latLng- the LatLng to inspectgeodesic- if this polygon is geodesic or nottolerance- the tolerance in meters
-
containsLocation
final static Boolean containsLocation(List<LatLng> $self, LatLng latLng, Boolean geodesic)
Computes whether the latLng lies inside this.
The polygon is always considered closed, regardless of whether the last point equals the first or not.
Inside is defined as not containing the South Pole -- the South Pole is always outside. The polygon is formed of great circle segments if geodesic is true, and of rhumb (loxodromic) segments otherwise.
- Parameters:
latLng- the LatLng to check if it is contained within this polygongeodesic- if this Polygon is geodesic or not
-
simplify
final static List<LatLng> simplify(List<LatLng> $self, Double tolerance)
Simplifies this list of LatLng using the Douglas-Peucker decimation. Increasing the value of tolerance will result in fewer points.
- Parameters:
tolerance- the tolerance in meters
-
toLatLngList
final static List<LatLng> toLatLngList(String $self)
Decodes this encoded string into a LatLng list.
-
latLngListEncode
final static String latLngListEncode(List<LatLng> $self)
Encodes this LatLng list in a String using the Polyline Algorithm Format.
-
isClosedPolygon
final static Boolean isClosedPolygon(List<LatLng> $self)
Checks whether or not this LatLng list is a closed Polygon.
-
sphericalPathLength
final static Double sphericalPathLength(List<LatLng> $self)
Computes the length of this path on Earth.
-
sphericalPolygonArea
final static Double sphericalPolygonArea(List<LatLng> $self)
Computes the area under a closed path on Earth.
-
sphericalPolygonSignedArea
final static Double sphericalPolygonSignedArea(List<LatLng> $self)
Computes the signed area under a closed path on Earth. The sign of the area may be used to determine the orientation of the path.
-
sphericalHeading
final static Double sphericalHeading(LatLng $self, LatLng toLatLng)
Computes the heading from this LatLng to toLatLng.
- Parameters:
toLatLng- the other LatLng to compute the heading to
-
withSphericalOffset
final static LatLng withSphericalOffset(LatLng $self, Double distance, Double heading)
Offsets this LatLng from the provided distance and heading and returns the result.
- Parameters:
distance- the distance to offset by in metersheading- the heading to offset by in degrees clockwise from north
-
computeSphericalOffsetOrigin
final static LatLng computeSphericalOffsetOrigin(LatLng $self, Double distance, Double heading)
Attempts to compute the origin LatLng from this LatLng where distance meters have been traveled with heading value heading.
- Parameters:
distance- the distance traveled from origin in metersheading- the heading from origin to this LatLng (measured in degrees clockwise from North)
-
withSphericalLinearInterpolation
final static LatLng withSphericalLinearInterpolation(LatLng $self, LatLng to, Double fraction)
Returns an interpolated LatLng between this LatLng and to by the provided fractional value fraction.
- Parameters:
to- the destination LatLngfraction- the fraction to interpolate by where the range is 0.0, 1.
-
sphericalDistance
final static Double sphericalDistance(LatLng $self, LatLng to)
Computes the spherical distance between this LatLng and to.
- Parameters:
to- the LatLng to compute the distance to
-
-
-
-