Skip to content

Commit

Permalink
Merge pull request #28 from habitus-eu/issue_26
Browse files Browse the repository at this point in the history
Add lwgeom to strong dependencies and generate error message when CRS not specified in GIS file
  • Loading branch information
vincentvanhees authored Aug 1, 2024
2 parents 06159e0 + 1bd8622 commit 1244f75
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ Authors@R:
person("Tom", "Stewart", role = "cph", email = "[email protected]",
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
4 changes: 4 additions & 0 deletions R/build_whenwhatwhere.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
Expand Down
1 change: 0 additions & 1 deletion R/hbGIS.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 1244f75

Please sign in to comment.