public final class LatLng extends Object implements HasLatLng, Parcelable
LatLng
s are immutable.
The valid range for latitude is between -90 and 90 degrees (both inclusive).
Longitude will always be between -180 (inclusive) and 180 (exclusive) degrees, but all functions
taking a longitude normalize the value to that range.Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static DecimalFormat |
COORDINATES_FORMAT
The format for coordinates.
|
static Parcelable.Creator<LatLng> |
CREATOR
Parcelable implementation. |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
Modifier and Type | Method and Description |
---|---|
static List<LatLng> |
decodeGooglePath(String encoded)
Decodes a list of coordinates encoded with
Google's polyline format
.
|
int |
describeContents()
Parcelable implementation. |
static String |
encodeGooglePath(List<LatLng> points)
Encodes a list of coordinates using
Google's polyline format
|
boolean |
equals(Object obj) |
static LatLng |
fromDegrees(double lat,
double lng)
Returns a
LatLng representing the given latitude and longitude, in degrees. |
static LatLng |
fromLocation(Location location)
|
static LatLng |
fromRadians(double lat,
double lng)
Returns a
LatLng representing the given latitude and longitude, in radians. |
double |
getLatDeg()
Returns the latitude, in degrees.
|
LatLng |
getLatLng()
Returns the location.
|
double |
getLatRad()
Returns the latitude, in radians.
|
double |
getLngDeg()
Returns the longitude, in degrees.
|
double |
getLngRad()
Returns the longitude, in degrees.
|
int |
hashCode() |
String |
toString() |
void |
writeToParcel(Parcel target,
int flags)
Parcelable implementation. |
public static final DecimalFormat COORDINATES_FORMAT
public static final Parcelable.Creator<LatLng> CREATOR
Parcelable
implementation.public static LatLng fromDegrees(double lat, double lng)
LatLng
representing the given latitude and longitude, in degrees.public static LatLng fromRadians(double lat, double lng)
LatLng
representing the given latitude and longitude, in radians.public double getLatDeg()
public double getLngDeg()
public double getLatRad()
public double getLngRad()
public static List<LatLng> decodeGooglePath(String encoded)
public static String encodeGooglePath(List<LatLng> points)
public LatLng getLatLng()
HasLatLng
public int describeContents()
Parcelable
implementation.describeContents
in interface Parcelable
public void writeToParcel(Parcel target, int flags)
Parcelable
implementation.writeToParcel
in interface Parcelable