public class LatLng extends Object implements ILatLng, Parcelable
Latitude and longitude are expressed as decimal degrees in the WGS84 datum. By default, altitude is 0.0, or sea level.
Mapbox GL displays maps in the Mercator Projection and projects geographical data automatically, so all data enters in the WGS84 datum.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<LatLng> |
CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier | Constructor and Description |
---|---|
|
LatLng()
Construct a new latitude, longitude point at (0, 0)
|
|
LatLng(double latitude,
double longitude)
Construct a new latitude, longitude point given float arguments
|
|
LatLng(double latitude,
double longitude,
double altitude)
Construct a new latitude, longitude, altitude point given float arguments
|
|
LatLng(LatLng aLatLng)
Clone an existing latitude longitude point
|
|
LatLng(Location location)
Transform a Location into a LatLng point
|
protected |
LatLng(Parcel in) |
Modifier and Type | Method and Description |
---|---|
int |
describeContents() |
double |
distanceTo(LatLng other)
Calculate distance between two points
|
boolean |
equals(Object object) |
double |
getAltitude() |
double |
getLatitude() |
double |
getLongitude() |
int |
hashCode() |
void |
setAltitude(double altitude) |
void |
setLatitude(double latitude) |
void |
setLongitude(double longitude) |
String |
toString() |
LatLng |
wrap()
Return a new LatLng object with a wrapped Longitude.
|
void |
writeToParcel(Parcel out,
int flags) |
public static final Parcelable.Creator<LatLng> CREATOR
public LatLng()
public LatLng(double latitude, double longitude)
latitude
- Latitude in degreeslongitude
- Longitude in degreespublic LatLng(double latitude, double longitude, double altitude)
latitude
- Latitude in degreeslongitude
- Longitude in degressaltitude
- Altitude in meterspublic LatLng(Location location)
location
- Android Locationpublic LatLng(LatLng aLatLng)
aLatLng
- LatLngprotected LatLng(Parcel in)
public void setLatitude(double latitude)
public double getLatitude()
getLatitude
in interface ILatLng
public void setLongitude(double longitude)
public double getLongitude()
getLongitude
in interface ILatLng
public void setAltitude(double altitude)
public double getAltitude()
getAltitude
in interface ILatLng
public LatLng wrap()
public int describeContents()
describeContents
in interface Parcelable
public void writeToParcel(Parcel out, int flags)
writeToParcel
in interface Parcelable
public double distanceTo(LatLng other)
other
- Other LatLng to compare to© 2015–2017 Mapbox. All rights reserved.