LatLng

public final class LatLng extends Object

An immutable class representing a pair of latitude and longitude coordinates, stored as degrees.

Field Summary

public final double latitude Latitude, in degrees.
public final double longitude Longitude, in degrees.

Public Constructor Summary

LatLng(double latitude, double longitude)
Constructs a LatLng with the given latitude and longitude, measured in degrees.

Public Method Summary

boolean
equals(Object o)
Tests if this LatLng is equal to another.
int
boolean
isCloseTo(LatLng other, double toleranceMeters)
Determines if two LatLngs are close to each other.
String

Inherited Method Summary

Fields

public final double latitude

Latitude, in degrees. This value is in the range [-90, 90].

public final double longitude

Longitude, in degrees. This value is in the range [-180, 180).

Public Constructors

public LatLng (double latitude, double longitude)

Constructs a LatLng with the given latitude and longitude, measured in degrees.

Parameters
latitude the point's latitude. This will be clamped to between -90 degrees and +90 degrees inclusive.
longitude the point's longitude. This will be normalized to be within -180 degrees inclusive and +180 degrees exclusive.

Public Methods

public boolean equals (Object o)

Tests if this LatLng is equal to another.

Two points are considered equal if and only if their latitudes are bitwise equal and their longitudes are bitwise equal. This means that two LatLngs that are very near, in terms of geometric distance, might not be considered equal.

Parameters
o

public int hashCode ()

public boolean isCloseTo (LatLng other, double toleranceMeters)

Determines if two LatLngs are close to each other.

Parameters
other the LatLng to compare against
toleranceMeters the max allowed distance in meters for two LatLngs to be considered close

public String toString ()