dwww Home | Show directory contents | Find package

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 

Generated by dwww version 1.15 on Sun Jun 30 09:44:56 CEST 2024.