Package ucar.unidata.view.geoloc
Class CoordinateFormat
java.lang.Object
ucar.unidata.view.geoloc.CoordinateFormat
The CoordinateFormat class to format geo coordinates.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
The Cardinality enum.static class
The DecimalCoordFormat.static enum
The Degrees Minutes Seconds enum.static class
The FloorCoordFormat class.static interface
The Format interface. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
convert
(double coord, CoordinateFormat.Format degF, CoordinateFormat.Format minF, CoordinateFormat.Format secF, CoordinateFormat.Cardinality card) Convert a decimal coordinate.static String
formatLatitude
(double value, String format) Format a longitude to the given format.static String
formatLongitude
(double value, String format, boolean use360) Format a latitude or longitude value to the given format.
-
Field Details
-
EMPTY_FORMAT
Empty format.
-
-
Constructor Details
-
CoordinateFormat
public CoordinateFormat()
-
-
Method Details
-
convert
public static String convert(double coord, CoordinateFormat.Format degF, CoordinateFormat.Format minF, CoordinateFormat.Format secF, CoordinateFormat.Cardinality card) Convert a decimal coordinate.- Parameters:
coord
- the decimal coorddegF
- the deg formatminF
- the min formatsecF
- the sec formatcard
- the cardinality- Returns:
- the formatted coordinate string
-
formatLatitude
Format a longitude to the given format.formatLongitude(double, String, boolean)
- Parameters:
value
- the value to formatformat
- the format- Returns:
- formatted latitude
-
formatLongitude
Format a latitude or longitude value to the given format. Formats use DD for degrees, MM for minutes, SS for seconds and d, m, s for decimal fractions of degrees, minutes, seconds. H designates the hemisphere (N,S,E,W).Examples for value -34.496 degrees DD:MM:SS ===> -34:29:45 (if longitude and use360 ===> 326:29:45) DDH ===> 34W (or 34S if longitude) DD.d ===> -34.5 DD.dddH ===> 34.496W (or 34.496S if longitude) DD MM'SS.s" ===> -34 29'45.6"
- Parameters:
value
- the value to formatformat
- the formatuse360
- if true use 0-360 notation instead of -180 to 180 notation- Returns:
- formatted longitude
-