public final class LatLng extends Object
| Constructor and Description |
|---|
LatLng(double latitude,
double longitude)
Creates an object representing a geographical point with the given
latitude and longitude.
|
| Modifier and Type | Method and Description |
|---|---|
double |
distanceTo(LatLng other)
Returns the distance (in meters) to the given LatLng calculated using the
Haversine formula.
|
boolean |
equals(Object other)
Returns
true if the given LatLng point is at the same
position (within a small margin of error). |
double |
getLatitude()
Getter for the latitude in degrees.
|
double |
getLongitude()
Getter for the longitude in degrees.
|
void |
setLatitude(double latitude)
Setter for the latitude in degrees.
|
void |
setLongitude(double longitude)
Setter for the longitude in degrees.
|
String |
toString()
Returns a string representation of the point (for debugging purposes).
|
LatLng |
wrap(double left,
double right)
Returns a new LatLng object with the longitude wrapped around left and right boundaries (-180 to 180 by default).
|
public LatLng(double latitude,
double longitude)
latitude - The latitude.longitude - The longitude.public double getLatitude()
public void setLatitude(double latitude)
latitude - The latitude in degrees.public double getLongitude()
public void setLongitude(double longitude)
longitude - The longitude in degrees.public double distanceTo(LatLng other)
other - The other latlng.public boolean equals(Object other)
true if the given LatLng point is at the same
position (within a small margin of error).public String toString()
public LatLng wrap(double left, double right)
left - The left boundary.right - The right boundary.Copyright © 2017. All rights reserved.