File: units.Rout.save

package info (click to toggle)
r-cran-sf 0.9-7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 6,796 kB
  • sloc: cpp: 5,333; sh: 18; makefile: 2
file content (67 lines) | stat: -rw-r--r-- 1,792 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

R version 3.5.3 (2019-03-11) -- "Great Truth"
Copyright (C) 2019 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> suppressPackageStartupMessages(library(sf))
> suppressPackageStartupMessages(library(units))
> 
> if (utils::packageVersion("units") >= "0.5-0")
+ 	units_options(auto_convert_names_to_symbols = FALSE)
> 
> ll = st_crs(4326)
> sf:::crs_parameters(ll)$ud_unit
1 [arc_degree]
> 
> u = names(sf:::udunits_from_proj)
> 
> unrecognized = NULL
> out = sapply(u, function(x) { 
+   p4s = paste0("+proj=laea +units=", x)
+   cat(x, ": ")
+   ret = try(sf:::crs_parameters(st_crs(p4s))$ud_unit, silent = TRUE)
+   if (! inherits(ret, "try-error"))
+   	print(ret)
+   else
+     unrecognized = c(unrecognized, x)
+ })
km : 1 [km]
m : 1 [m]
dm : 1 [dm]
cm : 1 [cm]
mm : 1 [mm]
kmi : 1 [nautical_mile]
in : 1 [in]
ft : 1 [ft]
yd : 1 [yd]
mi : 1 [mi]
fath : 1 [fathom]
ch : 1 [chain]
link : 1 [link]
us-in : 1 [us_in]
us-ft : 1 [US_survey_foot]
us-yd : 1 [US_survey_yard]
us-ch : 1 [chain]
us-mi : 1 [US_survey_mile]
ind-yd : 1 [ind_yd]
ind-ft : 1 [ind_ft]
ind-ch : 1 [ind_ch]
> 
> if (length(unrecognized))
+ 	print(paste("unrecognized units:", paste(unrecognized, collapse = ", "), ": older GDAL version?"))
> 
> proc.time()
   user  system elapsed 
  0.426   0.012   0.429