Package 

Class LatLngKt

    • Method Summary

      Modifier and Type Method Description
      final static Double component1(LatLng $self) Returns the LatLng.latitude of this LatLng.
      final static Double component2(LatLng $self) Returns the LatLng.longitude of this LatLng.
      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).
      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).
      final static Boolean containsLocation(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 String latLngListEncode(List<LatLng> $self) Encodes this LatLng list in a String using the Polyline Algorithm Format.
      final static Boolean isClosedPolygon(List<LatLng> $self) Checks whether or not this LatLng list is a closed Polygon.
      final static Double sphericalPathLength(List<LatLng> $self) Computes the length of this path on Earth.
      final static Double sphericalPolygonArea(List<LatLng> $self) Computes the area under a closed path on Earth.
      final static Double sphericalPolygonSignedArea(List<LatLng> $self) Computes the signed area under a closed path on Earth.
      final static Double sphericalHeading(LatLng $self, LatLng toLatLng) Computes the heading from this LatLng to toLatLng.
      final static LatLng withSphericalOffset(LatLng $self, Double distance, Double heading) Offsets this LatLng from the provided distance and heading and returns the result.
      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.
      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.
      final static Double sphericalDistance(LatLng $self, LatLng to) Computes the spherical distance between this LatLng and to.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 inspect
        geodesic - if this polyline is geodesic or not
        tolerance - 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 inspect
        geodesic - if this polygon is geodesic or not
        tolerance - 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 polygon
        geodesic - 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.

      • isClosedPolygon

         final static Boolean isClosedPolygon(List<LatLng> $self)

        Checks whether or not this LatLng list is a closed Polygon.

      • 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 meters
        heading - 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 meters
        heading - 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 LatLng
        fraction - 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