public class LatLon extends Coordinate implements ILatLon
| Modifier and Type | Field and Description |
|---|---|
static DecimalFormat |
cDdFormatter
The normal number format for server precision coordinates
|
static DecimalFormat |
cDdHighPrecisionFormatter
The number format used for high precision coordinates
|
static double |
MAX_SERVER_INV_PRECISION
The inverse of the server precision
|
static double |
MAX_SERVER_PRECISION
Minimum difference in location to not be represented as the same position.
|
static LatLon |
NORTH_POLE
North pole.
|
private static long |
serialVersionUID |
static LatLon |
SOUTH_POLE
South pole.
|
static LatLon |
ZERO
The (0,0) coordinates.
|
x, y| Constructor and Description |
|---|
LatLon(double lat,
double lon)
Constructs a new object representing the given latitude/longitude.
|
LatLon(ILatLon coor)
Creates a new LatLon object for the given coordinate
|
| Modifier and Type | Method and Description |
|---|---|
double |
bearing(LatLon other)
Deprecated.
since 18494 (use
ILatLon.bearing(ILatLon) instead) |
double |
distance(LatLon ll)
Returns the euclidean distance from this
LatLon to a specified LatLon. |
double |
distanceSq(LatLon ll)
Returns the square of the euclidean distance from this
LatLon to a specified LatLon. |
boolean |
equals(Object obj) |
boolean |
equalsEpsilon(LatLon other)
Deprecated.
since 18464 (use
ILatLon.equalsEpsilon(ILatLon) instead) |
LatLon |
getCenter(LatLon ll2)
Get the center between two lat/lon points
|
LatLon |
getRoundedToOsmPrecision()
Replies a clone of this lat LatLon, rounded to OSM precisions, i.e.
|
double |
greatCircleDistance(LatLon other)
Deprecated.
since 18494 (use
ILatLon.greatCircleDistance(ILatLon) instead) |
int |
hashCode() |
LatLon |
interpolate(LatLon ll2,
double proportion)
Interpolate between this and a other latlon.
|
boolean |
isIn(Area a)
Check if this is contained in given area or area is null.
|
boolean |
isOutSideWorld()
Deprecated.
use
Node.isOutSideWorld() instead, see also #13538. |
boolean |
isValid()
Replies true if lat is in the range [-90,90] and lon is in the range [-180,180]
|
static boolean |
isValidLat(double lat)
Replies true if lat is in the range [-90,90]
|
static boolean |
isValidLon(double lon)
Replies true if lon is in the range [-180,180]
|
boolean |
isWithin(Bounds b)
Determines if this lat/lon is within the given bounding box.
|
double |
lat()
Returns the latitude, i.e., the north-south position in degrees.
|
double |
lon()
Returns the longitude, i.e., the east-west position in degrees.
|
static double |
normalizeLon(double lon)
Make sure longitude value is within
[-180, 180] range. |
static double |
roundToOsmPrecision(double value)
Returns the value rounded to OSM precisions, i.e.
|
String |
toDisplayString()
Returns this lat/lon pair in human-readable format.
|
static double |
toIntervalLat(double value)
Clamp the lat value to be inside the world.
|
static double |
toIntervalLon(double value)
Returns a valid OSM longitude [-180,+180] for the given extended longitude value.
|
String |
toString() |
distance, distance, distanceSq, distanceSq, getX, getYclone, finalize, getClass, notify, notifyAll, wait, wait, waitbearing, distanceSq, distanceSq, equalsEpsilon, equalsEpsilon, getEastNorth, greatCircleDistance, interpolate, isLatLonKnownprivate static final long serialVersionUID
public static final double MAX_SERVER_PRECISION
public static final double MAX_SERVER_INV_PRECISION
MAX_SERVER_PRECISION,
Constant Field Valuespublic static final LatLon NORTH_POLE
public static final LatLon SOUTH_POLE
public static final DecimalFormat cDdFormatter
public static final DecimalFormat cDdHighPrecisionFormatter
public LatLon(double lat, double lon)
lat - the latitude, i.e., the north-south position in degreeslon - the longitude, i.e., the east-west position in degreespublic static boolean isValidLat(double lat)
lat - the latitudepublic static boolean isValidLon(double lon)
lon - the longitudepublic static double normalizeLon(double lon)
[-180, 180] range.lon - the longitude in degrees360, as needed to get
in [-180, 180] rangepublic boolean isValid()
public static double toIntervalLat(double value)
value - The valuepublic static double toIntervalLon(double value)
value - A longitude value not restricted to the [-180,+180] range.public double lat()
ILatLonlat in interface ILatLonILatLon.isLatLonKnown() returns falsepublic double lon()
ILatLonlon in interface ILatLonILatLon.isLatLonKnown() returns false@Deprecated public boolean equalsEpsilon(LatLon other)
ILatLon.equalsEpsilon(ILatLon) instead)other - other lat/lontrue if the other point has almost the same lat/lon
values, only differing by no more than 1 / MAX_SERVER_PRECISION.@Deprecated public boolean isOutSideWorld()
Node.isOutSideWorld() instead, see also #13538.true, if the coordinate is outside the world, compared by using lat/lon.public boolean isWithin(Bounds b)
b - bounding boxtrue if this is within the given bounding box.public boolean isIn(Area a)
a - Areatrue if this is contained in given area or area is null.@Deprecated public double greatCircleDistance(LatLon other)
ILatLon.greatCircleDistance(ILatLon) instead)other - the other point.@Deprecated public double bearing(LatLon other)
ILatLon.bearing(ILatLon) instead)other - the "destination" positionpublic String toDisplayString()
public LatLon interpolate(LatLon ll2, double proportion)
ILatLon.interpolate(ILatLon, double)
instead.ll2 - The other lat/lon objectproportion - The proportion to interpolatepublic LatLon getCenter(LatLon ll2)
ll2 - The other LatLonpublic double distance(LatLon ll)
LatLon to a specified LatLon.ll - the specified coordinate to be measured against this LatLonLatLon to a specified LatLonpublic double distanceSq(LatLon ll)
LatLon to a specified LatLon.ll - the specified coordinate to be measured against this LatLonLatLon to a specified LatLonpublic static double roundToOsmPrecision(double value)
MAX_SERVER_PRECISION.value - lat/lon valuepublic LatLon getRoundedToOsmPrecision()
MAX_SERVER_PRECISIONpublic int hashCode()
hashCode in class Coordinatepublic boolean equals(Object obj)
equals in class Coordinate