diff --git a/DESCRIPTION b/DESCRIPTION index 82eb1a3..6992f53 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,11 +11,11 @@ Authors@R: person("Tom", "Stewart", role = "cph", email = "tom.stewart@aut.ac.nz", comment = "holds copyright over original palmsplusr code")) License: LGPL-3 | file LICENSE -Imports: dplyr, sf, readr, tidyr, stringr, palmsplusr, data.table, rlang, purrr, geosphere +Imports: dplyr, sf, readr, tidyr, stringr, palmsplusr, data.table, rlang, purrr, geosphere, lwgeom Remotes: vincentvanhees/palmsplusr LazyData: true Suggests: testthat, covr, rmarkdown Depends: stats, utils, R (>= 3.5.0) Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 diff --git a/R/build_whenwhatwhere.R b/R/build_whenwhatwhere.R index b6c2fb3..d04276e 100644 --- a/R/build_whenwhatwhere.R +++ b/R/build_whenwhatwhere.R @@ -30,6 +30,10 @@ build_whenwhatwhere <- function(data = NULL, verbose = TRUE, whenwhat_field = NU Nlocations = length(loca) for (i in 1:Nlocations) { for (j in 1:2) { + if (is.na(st_crs(loca[[i]][[j]]))) { + stop(paste0("GIS file lacks coordinate reference system specification", + " as expected by hbGIS"), call. = FALSE) + } txt = paste0(names(loca[[i]])[j], " = loca[[i]][[j]]") eval(parse(text = txt)) } diff --git a/R/hbGIS.R b/R/hbGIS.R index f4fc82c..ab7fec7 100644 --- a/R/hbGIS.R +++ b/R/hbGIS.R @@ -422,7 +422,6 @@ hbGIS <- function(gisdir = "", if (verbose) cat("\n<<< building whenwhatwhere...\n") if (length(palms) > 0 & length(whenwhat_field) & all(Nlocation_objects > 0) & length(participant_basis) > 0) { - whenwhatwhere <- build_whenwhatwhere(data = palms, whenwhat_field = whenwhat_field, loca = loca,