- java.lang.Object
-
- org.arakhne.afc.gis.coordinate.GeodesicPosition
-
- All Implemented Interfaces:
Serializable
,Cloneable
public class GeodesicPosition extends Object implements Cloneable, Serializable
Describes a GPS position in the geographic WSG84 standard.The geographic latitude (abbreviation: Lat., or phi) of a point on the Earth's surface is the angle between the equatorial plane and a line that passes through that point and is normal to the surface of a reference ellipsoid which approximates the shape of the Earth. This line passes a few kilometers away from the center of the Earth except at the poles and the equator where it passes through Earth's center. Lines joining points of the same latitude trace circles on the surface of the Earth called parallels, as they are parallel to the equator and to each other. The north pole is 90° N; the south pole is 90° S. The 0° parallel of latitude is designated the equator, the fundamental plane of all geographic coordinate systems. The equator divides the globe into Northern and Southern Hemispheres.
The Longitude (abbreviation: Long., or lambda) of a point on the Earth's surface is the angle east or west from a reference meridian to another meridian that passes through that point. All meridians are halves of great ellipses (often improperly called great circles), which converge at the north and south poles.
- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Field Summary
Fields Modifier and Type Field Description static GeodesicPositionStringRepresentation
DEFAULT_STRING_REPRESENTATION
Default string representation when not defined by the user.static boolean
DEFAULT_SYMBOL_IN_STRING_REPRESENTATION
Default usage of the direction symbols in the string representation when not defined by the user.double
lambda
Lambda component in the WSG84 standard.double
phi
Phi component in the WSG84 standard.
-
Constructor Summary
Constructors Constructor Description GeodesicPosition(double lambda, double phi)
Construct a GSC position.GeodesicPosition(int latDegree, int latMinute, double latSecond, SexagesimalLatitudeAxis latAxis, int longDegree, int longMinute, double longSecond, SexagesimalLongitudeAxis longAxis)
Construct a GSC position from its sexagesimal representation.GeodesicPosition(GeodesicPosition position)
Construct a GSC position.GeodesicPosition(Tuple2D<?> position)
Construct a GSC position.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
static boolean
getDirectionSymbolInPreferredStringRepresentation()
Replies if the direction symbol should be output in the preferred string representation of a geodesic position.double
getLatitude()
Replies the latitude phi.SexagesimalLatitudeAxis
getLatitudeAxis()
Replies the axis of the sexagesimal representation of the latitude phi.int
getLatitudeDegree()
Replies the degree of the sexagesimal representation of the latitude phi.int
getLatitudeMinute()
Replies the minute of the sexagesimal representation of the latitude phi.double
getLatitudeSecond()
Replies the second of the sexagesimal representation of the latitude phi.double
getLongitude()
Replies the longitude lamda.SexagesimalLongitudeAxis
getLongitudeAxis()
Replies the axis of the sexagesimal representation of the longitude phi.int
getLongitudeDegree()
Replies the degree of the sexagesimal representation of the longitude phi.int
getLongitudeMinute()
Replies the minute of the sexagesimal representation of the longitude phi.double
getLongitudeSecond()
Replies the second of the sexagesimal representation of the longitude phi.static GeodesicPositionStringRepresentation
getPreferredStringRepresentation()
Replies the preferred format of the string representation of a geodesic position.static GeodesicPositionStringRepresentation
getPreferredStringRepresentation(boolean allowNullValue)
Replies the preferred format of the string representation of a geodesic position.int
hashCode()
static void
setPreferredStringRepresentation(GeodesicPositionStringRepresentation representation, boolean useSymbolicDirection)
Set the preferred format of the string representation of a geodesic position.static String
toDecimalDegreeMinuteString(double lambda, double phi, boolean useSymbolicDirection)
Replies the string representation of the longitude/latitude coordinates in the Decimal Degree Minute format: coordinate containing degrees (integer) and minutes (integer, or real number).static String
toDecimalDegreeString(double lambda, double phi, boolean useSymbolicDirection)
Replies the string representation of the longitude/latitude coordinates in the Decimal Degree format: coordinate containing only degrees (integer, or real number).static String
toDMSString(double lambda, double phi, boolean useSymbolicDirection)
Replies the string representation of the longitude/latitude coordinates in the DMS format: coordinate containing degrees (integer), minutes (integer), and seconds (integer, or real number).Point2d
toPoint2d()
Replies the GPS position as a point, wherex
is lambda andy
is phi.String
toString()
Replies the string representation of this geodesic position according to the preferred string format replied bygetPreferredStringRepresentation()
andgetDirectionSymbolInPreferredStringRepresentation()
.
-
-
-
Field Detail
-
DEFAULT_STRING_REPRESENTATION
public static final GeodesicPositionStringRepresentation DEFAULT_STRING_REPRESENTATION
Default string representation when not defined by the user.
-
DEFAULT_SYMBOL_IN_STRING_REPRESENTATION
public static final boolean DEFAULT_SYMBOL_IN_STRING_REPRESENTATION
Default usage of the direction symbols in the string representation when not defined by the user.- See Also:
- Constant Field Values
-
lambda
public final double lambda
Lambda component in the WSG84 standard.
-
phi
public final double phi
Phi component in the WSG84 standard.
-
-
Constructor Detail
-
GeodesicPosition
public GeodesicPosition(int latDegree, int latMinute, double latSecond, SexagesimalLatitudeAxis latAxis, int longDegree, int longMinute, double longSecond, SexagesimalLongitudeAxis longAxis)
Construct a GSC position from its sexagesimal representation.- Parameters:
latDegree
- is the latitute degree in [0;180)latMinute
- is the latitute minute in [0;60)latSecond
- is the latitute second in [0;60)latAxis
- is the axis of the given latitude coordinate.longDegree
- is the longitude degree in [0;180)longMinute
- is the longitude minute in [0;60)longSecond
- is the longitude second in [0;60)longAxis
- is the axis of the given longitude coordinate.
-
GeodesicPosition
public GeodesicPosition(double lambda, double phi)
Construct a GSC position.- Parameters:
lambda
- is the longitude in degrees.phi
- is the latitude in degrees.
-
GeodesicPosition
public GeodesicPosition(GeodesicPosition position)
Construct a GSC position.- Parameters:
position
- in degrees.
-
GeodesicPosition
public GeodesicPosition(Tuple2D<?> position)
Construct a GSC position.- Parameters:
position
- in degrees.
-
-
Method Detail
-
getLatitude
@Pure public double getLatitude()
Replies the latitude phi.- Returns:
- phi in degrees.
-
getLatitudeDegree
@Pure public int getLatitudeDegree()
Replies the degree of the sexagesimal representation of the latitude phi.- Returns:
- the latitude degree in [0;180).
-
getLatitudeMinute
@Pure public int getLatitudeMinute()
Replies the minute of the sexagesimal representation of the latitude phi.- Returns:
- the latitude minute in [0;60).
-
getLatitudeSecond
@Pure public double getLatitudeSecond()
Replies the second of the sexagesimal representation of the latitude phi.- Returns:
- the latitude second in [0;60).
-
getLatitudeAxis
@Pure public SexagesimalLatitudeAxis getLatitudeAxis()
Replies the axis of the sexagesimal representation of the latitude phi.- Returns:
- the axis of the latitude.
-
getLongitude
@Pure public double getLongitude()
Replies the longitude lamda.- Returns:
- lambda in degrees.
-
getLongitudeDegree
@Pure public int getLongitudeDegree()
Replies the degree of the sexagesimal representation of the longitude phi.- Returns:
- the longitude degree in [0;180).
-
getLongitudeMinute
@Pure public int getLongitudeMinute()
Replies the minute of the sexagesimal representation of the longitude phi.- Returns:
- the longitude minute in [0;60).
-
getLongitudeSecond
@Pure public double getLongitudeSecond()
Replies the second of the sexagesimal representation of the longitude phi.- Returns:
- the longitude second in [0;60).
-
getLongitudeAxis
@Pure public SexagesimalLongitudeAxis getLongitudeAxis()
Replies the axis of the sexagesimal representation of the longitude phi.- Returns:
- the axis of the latitude.
-
toPoint2d
@Pure public Point2d toPoint2d()
Replies the GPS position as a point, wherex
is lambda andy
is phi.- Returns:
- the point representation of this GPS position in degrees..
-
toDMSString
@Pure public static String toDMSString(double lambda, double phi, boolean useSymbolicDirection)
Replies the string representation of the longitude/latitude coordinates in the DMS format: coordinate containing degrees (integer), minutes (integer), and seconds (integer, or real number).Example with symbolic direction:
40°26'47"N 79°58'36"W
Example without symbolic direction:40°26'47" -79°58'36"
- Parameters:
lambda
- is the longitude in degrees.phi
- is the latitude in degrees.useSymbolicDirection
- indicates if the directions should be output with there symbols or if there are represented by the signs of the coordinates.- Returns:
- the string representation of the longitude/latitude coordinates.
-
toDecimalDegreeString
@Pure public static String toDecimalDegreeString(double lambda, double phi, boolean useSymbolicDirection)
Replies the string representation of the longitude/latitude coordinates in the Decimal Degree format: coordinate containing only degrees (integer, or real number).Example:
40.446195N 79.948862W
- Parameters:
lambda
- is the longitude in degrees.phi
- is the latitude in degrees.useSymbolicDirection
- indicates if the directions should be output with there symbols or if there are represented by the signs of the coordinates.- Returns:
- the string representation of the longitude/latitude coordinates.
-
toDecimalDegreeMinuteString
@Pure public static String toDecimalDegreeMinuteString(double lambda, double phi, boolean useSymbolicDirection)
Replies the string representation of the longitude/latitude coordinates in the Decimal Degree Minute format: coordinate containing degrees (integer) and minutes (integer, or real number).Example:
40° 26.7717N 79° 56.93172W
- Parameters:
lambda
- is the longitude in degrees.phi
- is the latitude in degrees.useSymbolicDirection
- indicates if the directions should be output with there symbols or if there are represented by the signs of the coordinates.- Returns:
- the string representation of the longitude/latitude coordinates.
-
setPreferredStringRepresentation
public static void setPreferredStringRepresentation(GeodesicPositionStringRepresentation representation, boolean useSymbolicDirection)
Set the preferred format of the string representation of a geodesic position.- Parameters:
representation
- indicates the preferred string representation, ornull
to use the default.useSymbolicDirection
- indicates if the directions should be output with there symbols or if there are represented by the signs of the coordinates.- See Also:
getPreferredStringRepresentation()
,toString()
-
getPreferredStringRepresentation
@Pure public static GeodesicPositionStringRepresentation getPreferredStringRepresentation()
Replies the preferred format of the string representation of a geodesic position.- Returns:
- the preferred string representation, or
null
to use the default; nevernull
. - See Also:
setPreferredStringRepresentation(GeodesicPositionStringRepresentation, boolean)
,getDirectionSymbolInPreferredStringRepresentation()
,toString()
-
getPreferredStringRepresentation
@Pure public static GeodesicPositionStringRepresentation getPreferredStringRepresentation(boolean allowNullValue)
Replies the preferred format of the string representation of a geodesic position.- Parameters:
allowNullValue
- indicates if thenull
value is enable for output in the replied value.- Returns:
- the preferred string representation, or
null
to use the default. Thenull
value is replied iff allowNullValue istrue
and if the default configuration is currently used. - See Also:
setPreferredStringRepresentation(GeodesicPositionStringRepresentation, boolean)
,getDirectionSymbolInPreferredStringRepresentation()
,toString()
-
getDirectionSymbolInPreferredStringRepresentation
@Pure public static boolean getDirectionSymbolInPreferredStringRepresentation()
Replies if the direction symbol should be output in the preferred string representation of a geodesic position.- Returns:
true
if the direction symbol should be output,false
if the signs of the coordinates indicate the directions.- See Also:
setPreferredStringRepresentation(GeodesicPositionStringRepresentation, boolean)
,getPreferredStringRepresentation()
,toString()
-
toString
@Pure public String toString()
Replies the string representation of this geodesic position according to the preferred string format replied bygetPreferredStringRepresentation()
andgetDirectionSymbolInPreferredStringRepresentation()
.- Overrides:
toString
in classObject
- Returns:
- the string representation of this geodesic position.
- See Also:
setPreferredStringRepresentation(GeodesicPositionStringRepresentation, boolean)
,getPreferredStringRepresentation()
,getDirectionSymbolInPreferredStringRepresentation()
-
-