public class LatLng extends Object
GeoUtils
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_EARTH_RADIUS_IN_KM
The default use earth radius in KM.
|
Constructor and Description |
---|
LatLng(double latitude,
double longitude)
Constructing a LatLng value object, and normalizing the degrees for latitude and longitude using default earth radius of 6371 Km and height of 0 Km.
|
LatLng(double latitude,
double longitude,
double height)
Constructing a LatLng value object, and normalizing the degrees for latitude and longitude using default earth radius of 6371 Km.
|
LatLng(double latitude,
double longitude,
double height,
double radius)
Constructing a LatLng value object, and normalizing the degrees for latitude and longitude.
|
LatLng(LatLng other)
Constructs a LatLng value on the basis of another LatLng instance.
|
LatLng(Point other)
Constructs an LatLng instance on the basis of java.awt.Point.
|
LatLng(Point2D.Double other)
Constructs an LatLng instance on the basis of java.awt.geom.Point2D.Double.
|
LatLng(Point2D other)
Constructs an LatLng instance on the basis of dk.heick.properties.types.customPoint2D.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Determines if this LatLng is equals with either another LatLng.
|
boolean |
equals(Object obj,
double precision)
Compares an other object with this.
|
Point2D |
getAsPoint2D()
Returns a instance of dk.heick.properties.types.customPoint2D where X is latitude and Y is longitude
|
double |
getBearingTo(LatLng toPoint) |
LatLng |
getDestinationPoint(double bearing,
double distance) |
double |
getDistanceBetweenPoints(LatLng pointTo) |
double |
getFinalBearingTo(LatLng toPoint) |
Double |
getHeight()
The height over the earths surface in Km
|
LatLng |
getIntersection(double firstIntialBearing,
LatLng toPoint,
double secondIntialBearing) |
Double |
getLatitude()
Gets the latitude in degrees
|
Double |
getLatitudeRadians()
Gets the latitude in radians.
|
Double |
getLongitude()
Gets the longitude in degrees
|
Double |
getLongitudeRadians()
Gets the longitude in radians.
|
LatLng |
getMidPointTo(LatLng toPoint) |
Double |
getRadius()
The earth radius in Km
|
double |
getRHumbBearingTo(LatLng toPoint) |
LatLng |
getRHumbDestinationPoint(double bearing,
double distance) |
double |
getRHumbDistanceTo(LatLng toPoint) |
LatLng |
getRHumbMidpointTo(LatLng toPoint) |
int |
hashCode() |
static LatLng |
parse(String value)
Parse a strnig value to a LatLng object, this can parse pretty must any format.
|
static String |
toBearing(Double degrees,
LatLngFormat format,
Integer dp) |
String |
toDMSString() |
String |
toDMSString(LatLngFormat format) |
String |
toDMSString(LatLngFormat format,
Integer dp)
Returns a string representation of 'this' point, formatted as degrees, degrees+minutes, or
degrees+minutes+seconds.
|
String |
toString() |
public static double DEFAULT_EARTH_RADIUS_IN_KM
public LatLng(double latitude, double longitude, double height, double radius)
latitude
- the latitude degrees, which will be normalized.longitude
- the longitude degrees, which will be normalized.height
- the height over the earth surface in Km.radius
- the radius of the earth in "Km", must between 6353 nd 6384.GeoUtils
,
GeoUtils.normalizeLatitudeDegrees(double)
,
GeoUtils.normalizeLongitudeDegrees(double)
public LatLng(double latitude, double longitude, double height)
latitude
- the latitude degrees, which will be normalized.longitude
- the longitude degrees, which will be normalized.height
- the height over the earth surface in Km.DEFAULT_EARTH_RADIUS_IN_KM
,
GeoUtils
,
GeoUtils.normalizeLatitudeDegrees(double)
,
GeoUtils.normalizeLongitudeDegrees(double)
public LatLng(double latitude, double longitude)
latitude
- the latitude degrees, which will be normalized.longitude
- the longitude degrees, which will be normalized.DEFAULT_EARTH_RADIUS_IN_KM
,
GeoUtils
,
GeoUtils.normalizeLatitudeDegrees(double)
,
GeoUtils.normalizeLongitudeDegrees(double)
public LatLng(LatLng other) throws NullPointerException
other
- another LatLng instance.NullPointerException
- if other is null
.public LatLng(Point2D other) throws NullPointerException
other
- a instance of dk.heick.properties.types.customPoint2D.NullPointerException
- if other is null
.public LatLng(Point other) throws NullPointerException
other
- a instance of java.awt.Point.NullPointerException
- if other is null
.public LatLng(Point2D.Double other) throws NullPointerException
other
- a instance of java.awt.geom.Point2D.Double.NullPointerException
- if other is null
.public static LatLng parse(String value) throws ParseException
value
- the string value of LatLng.ParseException
- if the value could not be parsed.GeoUtils.parseLatLng(String)
public Double getHeight()
public Double getLatitude()
public Double getLongitude()
public Double getRadius()
public Double getLatitudeRadians()
Math.toRadians(double)
public Double getLongitudeRadians()
Math.toRadians(double)
public String toDMSString(LatLngFormat format, Integer dp)
format
- [format=dms] - Format point as 'd', 'dm', 'dms'.dp
- [dp=0|2|4] - Number of decimal places to use - default 0 for dms, 2 for dm, 4 for d.public String toDMSString(LatLngFormat format)
public String toDMSString()
public Point2D getAsPoint2D()
public boolean equals(Object obj)
equals
in class Object
equals(Object, double)
,
{@inheritDoc}
public boolean equals(Object obj, double precision)
obj
- the other objectprecision
- the precesion at shall compare the doubles values with.false
if obj
is null
or not of type LatLng. Otherwise it compare the values from LatLng and returns if delta of both values are below precision.public double getDistanceBetweenPoints(LatLng pointTo)
public double getBearingTo(LatLng toPoint)
GeoUtils.getBearingTo(LatLng, LatLng)
public double getFinalBearingTo(LatLng toPoint)
public LatLng getMidPointTo(LatLng toPoint)
GeoUtils.getMidPointTo(LatLng, LatLng)
public LatLng getDestinationPoint(double bearing, double distance)
public LatLng getIntersection(double firstIntialBearing, LatLng toPoint, double secondIntialBearing)
public double getRHumbDistanceTo(LatLng toPoint)
public double getRHumbBearingTo(LatLng toPoint)
public LatLng getRHumbDestinationPoint(double bearing, double distance)
public static String toBearing(Double degrees, LatLngFormat format, Integer dp)
GeoUtils.toBearing(Double, LatLngFormat)