The class provides a container for coordinates stored as degree, minute, decimal second values.

Objects from the Class

Objects can be created by calls of the form new("DMS", ...), converted from decimal degrees using dd2dms(), or converted from character strings using char2dms().

Slots

WS:

Object of class "logical" TRUE if input value negative

deg:

Object of class "numeric" degrees

min:

Object of class "numeric" minutes

sec:

Object of class "numeric" decimal seconds

NS:

Object of class "logical" TRUE if input value is a Northing

Methods

coerce

signature(from = "DMS", to = "numeric"): convert to decimal degrees

show

signature(object = "DMS"): print data values

Author

Roger Bivand Roger.Bivand@nhh.no

See also

Examples

data(state)
dd2dms(state.center$x)
#>  [1] 86d45'3.24"W  127d15'W      111d37'30"W   92d17'57.12"W 119d46'22.8"W
#>  [6] 105d30'46.8"W 72d21'26.28"W 74d59'2.76"W  81d41'6"W     83d22'24.96"W
#> [11] 126d15'W      113d55'48"W   89d22'39.36"W 86d4'50.88"W  93d22'17.04"W
#> [16] 98d6'56.16"W  84d46'2.64"W  92d16'20.64"W 68d58'48.36"W 76d38'45.24"W
#> [21] 71d34'48"W    84d41'13.2"W  94d36'15.48"W 89d48'23.4"W  92d30'49.32"W
#> [26] 109d19'12"W   99d35'23.28"W 116d51'3.6"W  71d23'32.64"W 74d14'0.96"W 
#> [31] 105d56'31.2"W 75d8'41.64"W  78d28'6.96"W  100d5'56.4"W  82d35'46.68"W
#> [36] 97d7'26.04"W  120d4'4.8"W   77d27'W       71d7'27.84"W  80d30'20.16"W
#> [41] 99d43'25.68"W 86d27'21.6"W  98d47'8.52"W  111d19'48"W   72d32'42"W   
#> [46] 78d12'1.8"W   119d44'45.6"W 80d39'59.4"W  89d59'38.76"W 107d15'21.6"W
dd2dms(state.center$y, NS=TRUE)
#>  [1] 32d35'24.36"N 49d15'N       34d13'9.12"N  34d44'0.96"N  36d32'2.76"N 
#>  [6] 38d40'39.72"N 41d35'34.08"N 38d40'39.72"N 27d52'27.84"N 32d19'58.44"N
#> [11] 31d45'N       43d33'53.28"N 40d2'58.2"N   40d2'58.2"N   41d56'8.88"N 
#> [16] 38d25'13.44"N 37d23'29.4"N  30d37'5.16"N  45d37'21.36"N 39d16'40.08"N
#> [21] 42d21'52.2"N  43d8'9.96"N   46d23'39.48"N 32d40'32.88"N 38d20'4.92"N 
#> [26] 46d49'22.8"N  41d20'8.16"N  39d6'22.68"N  43d23'36.24"N 39d57'49.32"N
#> [31] 34d28'35.04"N 43d8'9.96"N   35d25'10.2"N  47d15'6.12"N  40d13'15.6"N 
#> [36] 35d30'19.08"N 43d54'28.08"N 40d54'24.84"N 41d35'34.08"N 33d37'8.4"N  
#> [41] 44d20'11.4"N  35d40'36.12"N 31d23'22.92"N 39d6'22.68"N  44d15'2.88"N 
#> [46] 37d33'46.8"N  47d25'23.16"N 38d25'13.44"N 44d35'37.32"N 43d3'1.44"N  
as.numeric(dd2dms(state.center$y))
#>  [1] 32.5901 49.2500 34.2192 34.7336 36.5341 38.6777 41.5928 38.6777 27.8744
#> [10] 32.3329 31.7500 43.5648 40.0495 40.0495 41.9358 38.4204 37.3915 30.6181
#> [19] 45.6226 39.2778 42.3645 43.1361 46.3943 32.6758 38.3347 46.8230 41.3356
#> [28] 39.1063 43.3934 39.9637 34.4764 43.1361 35.4195 47.2517 40.2210 35.5053
#> [37] 43.9078 40.9069 41.5928 33.6190 44.3365 35.6767 31.3897 39.1063 44.2508
#> [46] 37.5630 47.4231 38.4204 44.5937 43.0504
as(dd2dms(state.center$y, NS=TRUE), "numeric")
#>  [1] 32.5901 49.2500 34.2192 34.7336 36.5341 38.6777 41.5928 38.6777 27.8744
#> [10] 32.3329 31.7500 43.5648 40.0495 40.0495 41.9358 38.4204 37.3915 30.6181
#> [19] 45.6226 39.2778 42.3645 43.1361 46.3943 32.6758 38.3347 46.8230 41.3356
#> [28] 39.1063 43.3934 39.9637 34.4764 43.1361 35.4195 47.2517 40.2210 35.5053
#> [37] 43.9078 40.9069 41.5928 33.6190 44.3365 35.6767 31.3897 39.1063 44.2508
#> [46] 37.5630 47.4231 38.4204 44.5937 43.0504
as.numeric.DMS(dd2dms(state.center$y))
#>  [1] 32.5901 49.2500 34.2192 34.7336 36.5341 38.6777 41.5928 38.6777 27.8744
#> [10] 32.3329 31.7500 43.5648 40.0495 40.0495 41.9358 38.4204 37.3915 30.6181
#> [19] 45.6226 39.2778 42.3645 43.1361 46.3943 32.6758 38.3347 46.8230 41.3356
#> [28] 39.1063 43.3934 39.9637 34.4764 43.1361 35.4195 47.2517 40.2210 35.5053
#> [37] 43.9078 40.9069 41.5928 33.6190 44.3365 35.6767 31.3897 39.1063 44.2508
#> [46] 37.5630 47.4231 38.4204 44.5937 43.0504
state.center$y
#>  [1] 32.5901 49.2500 34.2192 34.7336 36.5341 38.6777 41.5928 38.6777 27.8744
#> [10] 32.3329 31.7500 43.5648 40.0495 40.0495 41.9358 38.4204 37.3915 30.6181
#> [19] 45.6226 39.2778 42.3645 43.1361 46.3943 32.6758 38.3347 46.8230 41.3356
#> [28] 39.1063 43.3934 39.9637 34.4764 43.1361 35.4195 47.2517 40.2210 35.5053
#> [37] 43.9078 40.9069 41.5928 33.6190 44.3365 35.6767 31.3897 39.1063 44.2508
#> [46] 37.5630 47.4231 38.4204 44.5937 43.0504