Class LatLngKt

  • All Implemented Interfaces:

    
    public final class LatLngKt
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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
    • Constructor Detail

    • 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
        Returns:

        true if latLng is on this path, otherwise, false

      • 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
        Returns:

        true if latLng lies on or is near the edge of this Polygon, otherwise, false

      • 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
        Returns:

        the simplified list of LatLng

      • toLatLngList

         final static List<LatLng> toLatLngList(String $self)

        Decodes this encoded string into a LatLng list.

        Returns:

        the decoded LatLng list

      • isClosedPolygon

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

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

        Returns:

        true if this list is a closed Polygon, otherwise, false

      • sphericalPathLength

         final static Double sphericalPathLength(List<LatLng> $self)

        Computes the length of this path on Earth.

        Returns:

        the length of this path in meters

      • sphericalPolygonArea

         final static Double sphericalPolygonArea(List<LatLng> $self)

        Computes the area under a closed path on Earth.

        Returns:

        the area in square meters

      • 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.

        Returns:

        the signed area in square meters

      • 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
        Returns:

        the heading expressed in degrees clockwise from North within the range -180, 180

      • 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
        Returns:

        the resulting LatLng

      • 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)
        Returns:

        the computed origin if a solution is available, otherwise, null

      • 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.
        Returns:

        the interpolated LatLng

      • 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
        Returns:

        the distance between this and to in meters