public class GeoPoint extends Object
Constructor and Description |
---|
GeoPoint(Double lat,
Double lon)
Instantiates a new GeoPoint
|
Modifier and Type | Method and Description |
---|---|
String |
asString()
Returns a string representation in the following format: "lat, long"
|
double |
distanceTo(GeoPoint other)
Calculates distance to geo point using Haversine formula in meters
Note: does not account for altitude
|
static GeoPoint |
fromMap(Map<String,Double> map)
Instantiates geo point from map of coordinates
|
static GeoPoint |
fromString(String input)
Instantiates geo point from string representation
|
Double |
getLat()
Retrieves latitude of the geo point
|
Double |
getLon()
Retrieves longitude of the geo point
|
public Double getLat()
public Double getLon()
public String asString()
public double distanceTo(GeoPoint other)
other
- GeoPoint to calculate distance topublic static GeoPoint fromMap(Map<String,Double> map)
map
- Map containing coordinates with keys "lat" and "lon"IllegalArgumentException
- Thrown if the input is not validpublic static GeoPoint fromString(String input)
input
- String geo point representation in the following format: "lat, lon"IllegalArgumentException
- Thrown if the input is not validCopyright © 2014–2023 Apache Software Foundation. All rights reserved.