library(ctmm)
setwd(dirname(rstudioapi::getActiveDocumentContext()$path))
#> Error: RStudio not running
data("buffalo")
Cilla <- buffalo$Cilla
# accepting the automatic pojection
projection(Cilla)
#> [1] "+proj=tpeqd +lon_1=31.7775407470691 +lat_1=-24.2850983757726 +lon_2=31.8880063438124 +lat_2=-25.024736901024 +datum=WGS84"
m.iid <- ctmm.fit(data = Cilla)
UD0 <- akde(Cilla,m.iid)
ctmm::writeShapefile(UD0,
"./shp_without_proj",
file="AKDE_reprex",
level.UD=0.95,
level=0.95)
# try redefining the projection
Cilla2 <- buffalo$Cilla
# test <- sf::st_crs(42106) # test does not come through with wkt as expected
# proj.4 string for epsg 42106 wg484 lambert azim mozambique
# projx <- sf::st_crs(42106)$proj4string # works if your gdal path includes sf/gdal
projx <- as.character(sp::CRS("+proj=laea +lat_0=5 +lon_0=20 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"))
projection(Cilla2) <- projx
projection(Cilla2)
#> [1] "+proj=laea +lat_0=5 +lon_0=20 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs"
m.iid2 <- ctmm.fit(data = Cilla2)
UD02 <- akde(Cilla2,m.iid2)
ctmm::writeShapefile(UD02,
"./shp_with_new_proj",
file="AKDE_reprex",
level.UD=0.95,
level=0.95)
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 4.0.4 (2021-02-15)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.1252
#> ctype English_United States.1252
#> tz America/Los_Angeles
#> date 2021-02-25
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.3)
#> backports 1.2.1 2020-12-09 [1] CRAN (R 4.0.3)
#> cli 2.3.1 2021-02-23 [1] CRAN (R 4.0.4)
#> codetools 0.2-18 2020-11-04 [2] CRAN (R 4.0.4)
#> crayon 1.4.1 2021-02-08 [1] CRAN (R 4.0.3)
#> ctmm * 0.6.0 2021-01-10 [1] CRAN (R 4.0.3)
#> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3)
#> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.3)
#> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.3)
#> fansi 0.4.2 2021-01-15 [1] CRAN (R 4.0.3)
#> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.3)
#> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.3)
#> highr 0.8 2019-03-20 [1] CRAN (R 4.0.3)
#> htmltools 0.5.1.1 2021-01-22 [1] CRAN (R 4.0.3)
#> knitr 1.31 2021-01-27 [1] CRAN (R 4.0.3)
#> lattice 0.20-41 2020-04-02 [2] CRAN (R 4.0.4)
#> lifecycle 1.0.0 2021-02-15 [1] CRAN (R 4.0.4)
#> magrittr 2.0.1 2020-11-17 [1] CRAN (R 4.0.3)
#> pillar 1.5.0 2021-02-22 [1] CRAN (R 4.0.4)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.3)
#> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.3)
#> raster 3.4-5 2020-11-14 [1] CRAN (R 4.0.3)
#> Rcpp 1.0.6 2021-01-15 [1] CRAN (R 4.0.3)
#> reprex 1.0.0 2021-01-27 [1] CRAN (R 4.0.3)
#> rgdal 1.5-23 2021-02-03 [1] CRAN (R 4.0.3)
#> rgeos 0.5-5 2020-09-07 [1] CRAN (R 4.0.3)
#> rlang 0.4.10 2020-12-30 [1] CRAN (R 4.0.3)
#> rmarkdown 2.7 2021-02-19 [1] CRAN (R 4.0.4)
#> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.0.3)
#> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.3)
#> sp 1.4-5 2021-01-10 [1] CRAN (R 4.0.3)
#> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.3)
#> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.3)
#> styler 1.3.2 2020-02-23 [1] CRAN (R 4.0.3)
#> tibble 3.0.6 2021-01-29 [1] CRAN (R 4.0.3)
#> utf8 1.1.4 2018-05-24 [1] CRAN (R 4.0.3)
#> vctrs 0.3.6 2020-12-17 [1] CRAN (R 4.0.3)
#> withr 2.4.1 2021-01-26 [1] CRAN (R 4.0.3)
#> xfun 0.21 2021-02-10 [1] CRAN (R 4.0.3)
#> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.3)
#>
#> [1] C:/Users/gcotterill/Documents/R/win-library/4.0
#> [2] C:/Program Files/R/R-4.0.4/library