org.apache.lucene.spatial.geometry

## Class LatLng

- java.lang.Object
- - org.apache.lucene.spatial.geometry.LatLng

- Direct Known Subclasses:
    FixedLatLng, FloatLatLng

      public abstract class LatLng
      extends java.lang.Object

  Abstract base lat-lng class which can manipulate fixed point or floating point based coordinates. Instances are immutable.
  See Also:
    `

    NOTE: This API is still in flux and might change in incompatible ways in the next release.

    `

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LatLng()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double` | `arcDistance(LatLng ll2)` Calculates the distance between two lat/lng's in miles.
    `double` | `arcDistance(LatLng ll2, DistanceUnits lUnits)` Calculates the distance between two lat/lng's in miles or meters.
    `abstract LatLng` | `calculateMidpoint(LatLng other)` Calculate the midpoint between this point an another.
    `abstract LatLng` | `copy()`
    `abstract boolean` | `equals(java.lang.Object obj)`
    `static LatLng` | `fromCartesian(CartesianPoint pt)` The inverse of toCartesian().
    `abstract int` | `getFixedLat()`
    `abstract int` | `getFixedLng()`
    `abstract double` | `getLat()`
    `abstract double` | `getLng()`
    `abstract int` | `hashCode()`
    `abstract boolean` | `isFixedPoint()`
    `abstract boolean` | `isNormalized()`
    `abstract LatLng` | `normalize()`
    `CartesianPoint` | `toCartesian()` Convert the lat/lng into the cartesian coordinate plane such that all world coordinates are represented in the first quadrant.
    `abstract FixedLatLng` | `toFixed()`
    `abstract FloatLatLng` | `toFloat()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LatLng

          public LatLng()

  - ### Method Detail

    - #### isNormalized

          public abstract boolean isNormalized()

    - #### isFixedPoint

          public abstract boolean isFixedPoint()

    - #### normalize

          public abstract LatLng normalize()

    - #### getFixedLat

          public abstract int getFixedLat()

    - #### getFixedLng

          public abstract int getFixedLng()

    - #### getLat

          public abstract double getLat()

    - #### getLng

          public abstract double getLng()

    - #### copy

          public abstract LatLng copy()

    - #### toFixed

          public abstract FixedLatLng toFixed()

    - #### toFloat

          public abstract FloatLatLng toFloat()

    - #### toCartesian

          public CartesianPoint toCartesian()

      Convert the lat/lng into the cartesian coordinate plane such that all world coordinates are represented in the first quadrant. The x dimension corresponds to latitude and y corresponds to longitude. The translation starts with the normalized latlng and adds 180 to the latitude and 90 to the longitude (subject to fixed point scaling).

    - #### fromCartesian

          public static LatLng fromCartesian(CartesianPoint pt)

      The inverse of toCartesian(). Always returns a FixedLatLng.
      Parameters:
        `pt` -

    - #### arcDistance

          public double arcDistance(LatLng ll2)

      Calculates the distance between two lat/lng's in miles. Imported from mq java client.
      Parameters:
        `ll2` - Second lat,lng position to calculate distance to.
      Returns:
        Returns the distance in miles.

    - #### arcDistance

          public double arcDistance(LatLng ll2,
                                    DistanceUnits lUnits)

      Calculates the distance between two lat/lng's in miles or meters. Imported from mq java client. Variable references changed to match.
      Parameters:
        `ll2` - Second lat,lng position to calculate distance to.
        `lUnits` - Units to calculate distance, defaults to miles
      Returns:
        Returns the distance in meters or miles.

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### calculateMidpoint

          public abstract LatLng calculateMidpoint(LatLng other)

      Calculate the midpoint between this point an another. Respects fixed vs floating point
      Parameters:
        `other` -

    - #### hashCode

          public abstract int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public abstract boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.