public class LatLng
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
LatLng(double latitude,
double longitude)
Instantiates a new LatLng object with provided latitude and longitude.
|
LatLng(double latitude,
double longitude,
double altitude)
Instantiates a new LatLng object with provided latitude, longitude and altitude.
|
LatLng(double latitude,
double longitude,
float bearing)
Instantiates a new LatLng object with provided latitude, longitude and bearing.
|
LatLng(double latitude,
double longitude,
int radius)
Instantiates a new LatLng object with provided latitude, longitude and radius.
|
LatLng(double latitude,
double longitude,
int radius,
float bearing)
Instantiates a new LatLng object with provided latitude, longitude, radius and bearing.
|
LatLng(android.location.Location location)
Instantiates a new LatLng object based on data from
Location object. |
| Modifier and Type | Method and Description |
|---|---|
Optional<java.lang.Double> |
getAltitude()
Get the altitude.
|
double |
getBearing() |
double |
getLatitude() |
java.lang.String |
getLatitudeAsString() |
double |
getLongitude() |
java.lang.String |
getLongitudeAsString() |
float |
getRadius() |
double |
greatCircleDistanceTo(LatLng other)
Calculate the great-circle distance between two points.
|
boolean |
hasRadius() |
boolean |
isNear(LatLng that)
Check if two locations are near each other (almost equal).
|
boolean |
isNear(LatLng that,
double tolerance)
Check if two locations are near each other (almost equal within given tolerance).
|
static double[] |
toArrayCoordinateSystem(java.util.List<LatLng> locations)
Transforms a list of
LatLng locations into an array of double values, ignoring
altitude, radius and bearing. |
java.lang.String |
toSimplerString()
Formatted string representation of the LatLng object in simpler way.
|
java.lang.String |
toSimpleString()
Formatted string representation of the LatLng object.
|
public LatLng(double latitude,
double longitude)
latitude - latitude valuelongitude - longitude valuepublic LatLng(double latitude,
double longitude,
double altitude)
latitude - latitude valuelongitude - longitude valuealtitude - altitude valuepublic LatLng(@NonNull
android.location.Location location)
Location object.location - a Location objectpublic LatLng(double latitude,
double longitude,
int radius)
latitude - latitude valuelongitude - longitude valueradius - radius valuepublic LatLng(double latitude,
double longitude,
float bearing)
latitude - latitude valuelongitude - longitude valuebearing - bearing valuepublic LatLng(double latitude,
double longitude,
int radius,
float bearing)
latitude - the latitude part of the coordinateslongitude - the longitude part of the coordinatesradius - the radiusbearing - the bearingpublic double getLongitude()
public double getLatitude()
public double getBearing()
public float getRadius()
public boolean hasRadius()
public Optional<java.lang.Double> getAltitude()
public boolean isNear(LatLng that)
that - the other locationpublic boolean isNear(LatLng that, double tolerance)
that - the other locationtolerance - criteria for coordinate equalitypublic java.lang.String toSimpleString()
public java.lang.String toSimplerString()
public double greatCircleDistanceTo(LatLng other)
other - locationpublic static double[] toArrayCoordinateSystem(java.util.List<LatLng> locations)
LatLng locations into an array of double values, ignoring
altitude, radius and bearing.
Latitude of location at index n is located at index n*2 in the resulting array.
Longitude of location at index n is located at index n*2+1 in the resulting array.locations - list of LatLng locationspublic java.lang.String getLongitudeAsString()
public java.lang.String getLatitudeAsString()