public class CoordinateDMS extends Object implements ICoordinate
Note: When the angle is negative, all components must be negative. For example, 0794731W corresponds to -79 deg 47' 31.111439999999998", but the individual components are actually -79, -47, and -31.1...
ICoordinate.UNITS
Modifier and Type | Field and Description |
---|---|
int |
degreesEast |
int |
degreesNorth |
static Logger |
log |
int |
minutesEast |
int |
minutesNorth |
int |
tenthsOfSecondsEast |
int |
tenthsOfSecondsNorth |
Constructor and Description |
---|
CoordinateDMS(int degreesNorth,
int minutesNorth,
int tenthsOfSecondsNorth,
int degreesEast,
int minutesEast,
int tenthsOfSecondsEast) |
Modifier and Type | Method and Description |
---|---|
double |
distance(ICoordinate o,
ICoordinate.UNITS units)
Computes the distance to the specified coordinate and returns that
distance in the specified units.
|
boolean |
equals(CoordinateDMS o)
True iff the two coordinates are exactly the same (to the tenths of the
second).
|
boolean |
equals(ICoordinate o)
Return true if two coordinates are exactly the same.
|
static CoordinateDMS |
parse(String text)
Some formats that are accepted:
32� 18' 23.1" N 122� 36' 52.5" W
32 18 23.1N 122 36 52.5 W
32 18 23.1N/122 36 52.5W
32:18:23N/122:36:52W
32:18:23.1N/122:36:52.5W
321823N/1223652W
(zeros would need to go in front of single digits and two zeros in front of the longitude degrees because it�s range is up to 180 � the latitude range is only up to 90) 3218N/12236W |
CoordinateDMS |
roundMinutes()
Rounds off the coordinate to the nearest minutes (rounds up at 30.0
seconds to the next highest minute).
|
CoordinateDMS |
roundSeconds()
Rounds off the coordinate to the nearest seconds.
|
CoordinateDD |
toDD()
Convert to decimal degrees.
|
CoordinateDDM |
toDDM()
Convert to degrees and decimal minutes.
|
CoordinateDMS |
toDMS()
Convert to degrees, minutes and (tenths of) seconds.
|
String |
toString()
Representation of the coordinate in degrees, minutes, and (tenths of)
seconds.
|
public static Logger log
public final int degreesNorth
public final int minutesNorth
public final int tenthsOfSecondsNorth
public final int degreesEast
public final int minutesEast
public final int tenthsOfSecondsEast
public CoordinateDMS(int degreesNorth, int minutesNorth, int tenthsOfSecondsNorth, int degreesEast, int minutesEast, int tenthsOfSecondsEast)
public String toString()
32 18 23.1N 122 36 52.5W
public CoordinateDMS roundSeconds()
public CoordinateDMS roundMinutes()
public boolean equals(ICoordinate o)
ICoordinate
Note: Coordinates MUST be expressed in the same system before they may be compared. E.g., Degrees, Minutes and Seconds or Degrees and Decimal Minutes or Decimal Degrees.
equals
in interface ICoordinate
o
- Another coordinate.public boolean equals(CoordinateDMS o)
o
- Another coordinate.public static CoordinateDMS parse(String text) throws ParseException
ParseException
public CoordinateDD toDD()
Decimal degrees = whole number of degrees, plus minutes divided by 60, plus seconds divided by 3600.
toDD
in interface ICoordinate
public double distance(ICoordinate o, ICoordinate.UNITS units)
ICoordinate
distance
in interface ICoordinate
o
- Another coordinate.units
- The units in which the distance will be reported.public CoordinateDMS toDMS()
ICoordinate
toDMS
in interface ICoordinate
public CoordinateDDM toDDM()
ICoordinate
toDDM
in interface ICoordinate
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.