GeoCoordinates (API Reference)
Class GeoCoordinates
Represents geographical coordinates in 3D space.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeoCoordinates(double latitude, double longitude) Constructs a GeoCoordinates from the provided latitude and longitude values.GeoCoordinates(double latitude, double longitude, double altitude) Constructs a GeoCoordinates from the provided latitude, longitude and altitude values. -
Method Summary
Modifier and TypeMethodDescriptiondoubledistanceTo(GeoCoordinates point) Computes distance (in meters) along the great circle between two coordinates.booleanstatic GeoCoordinatesfromString(String input) Constructs GeoCoordinates from the provided string in specified format.inthashCode()interpolate(GeoCoordinates towardCoords, double factor) Computes the coordinates of the interpolated location along the great circle between the two coordinates.
-
Field Details
-
latitude
public final double latitudeLatitude in degrees.
-
longitude
public final double longitudeLongitude in degrees.
-
altitude
Optional altitude in meters. By convention, on iOS devices, altitude is set as meters relative to the mean sea level. On Android devices, altitude is set as meters relative to the WGS 84 reference ellipsoid.
-
-
Constructor Details
-
GeoCoordinates
public GeoCoordinates(double latitude, double longitude, double altitude) Constructs a GeoCoordinates from the provided latitude, longitude and altitude values. Corrects values of lat and long if they exceed the ranges.
- Parameters:
latitude-Latitude in degrees. Positive value means Northern hemisphere. If the value is out of range of [-90.0, 90.0] it's clamped to that range. NaN value is converted to 0.0.
longitude-Longitude in degrees. Positive value means Eastern hemisphere. If the value is out of range of [-180.0, 180.0] it's replaced with a value within the range, representing effectively the same meridian. NaN value is converted to 0.0.
altitude-Altitude in meters. NaN value is converted to
null.
-
GeoCoordinates
public GeoCoordinates(double latitude, double longitude) Constructs a GeoCoordinates from the provided latitude and longitude values. Corrects values of latitude and longitude if they exceed the ranges. Altitude set to
null.- Parameters:
latitude-Latitude in degrees. Positive value means Northern hemisphere. If the value is out of range of [-90.0, 90.0] it's clamped to that range. NaN value is converted to 0.0.
longitude-Longitude in degrees. Positive value means Eastern hemisphere. If the value is out of range of [-180.0, 180.0] it's replaced with a value within the range, representing effectively the same meridian. NaN value is converted to 0.0.
-
-
Method Details
-
equals
-
hashCode
public int hashCode() -
distanceTo
Computes distance (in meters) along the great circle between two coordinates. This method ignores altitude of both points.
- Parameters:
point-Coordinates of the point to which the distance is computed.
- Returns:
distance in meters.
-
interpolate
Computes the coordinates of the interpolated location along the great circle between the two coordinates.
The interpolation factor is clamped to the range
[0.0, 1.0]where0.0identifies thisGeoCoordinatesand1.0indicates the other coordinates.The ratio between the distance to the interpolated coordinates and the distance to the other coordinates is approximately equal to the interpolation factor. When both coordinates have the altitude, then the altitude is interpolated as well;
nullotherwise.- Parameters:
towardCoords-Coordinates of the point to which the interpolation is directed.
factor-The interpolation factor
- Returns:
interpolated coordinates
-
fromString
Constructs GeoCoordinates from the provided string in specified format. Corrects values of lat and long if they exceed the ranges. If the latitude value is out of range of [-90.0, 90.0] it's clamped to that range. If the longitude value is out of range of [-180.0, 180.0] it's replaced with a value within the range, representing effectively the same meridian. Examples:
53.43762,-13.65468.49°59'56.948"N, 15°48'22.989"E50d4m17.698N 14d24m2.826E49.9991522N, 150.8063858E40°26′47″N 79°58′36″W- Parameters:
input-String representing GeoCoordinates in one of supported formats.
- Returns:
Created GeoCoordinates, or 'null' if string was not in appropriate format.
-