diff --git a/R/forest-inventory.R b/R/forest-inventory.R index 1399d6e..fc385c1 100644 --- a/R/forest-inventory.R +++ b/R/forest-inventory.R @@ -115,7 +115,7 @@ fd_inventory_spain <- function(province, } } else { ## 4.1. File name - filename <- list.files(dir_unzip, full.names = TRUE, pattern = "\\.accdb$") + filename <- list.files(dir_unzip, full.names = TRUE, pattern = "\\.accdb$|\\.mdb$") ## 4.2. Connect to DB conn <- RODBC::odbcConnectAccess2007(filename) on.exit(RODBC::odbcClose(conn)) @@ -144,8 +144,10 @@ fd_inventory_spain <- function(province, .default = 258 ) ## convert to spatial + na_data <- data_lst$PCDatosMap |> dplyr::filter(is.na(CoorX)) + if (nrow(na_data) > 0) cli::cli_alert_warning("Plot(s) {paste0(na_data$Estadillo, collapse = ',')} do not have coordinates, and are eliminate from `PCDatosMap_sf` table") data_lst$PCDatosMap_sf <- sf::st_as_sf( - x = data_lst$PCDatosMap, + x = data_lst$PCDatosMap |> dplyr::filter(!is.na(CoorX)), coords = c("CoorX", "CoorY"), crs = paste0("EPSG:", datum, data_lst$PCDatosMap$Huso[1]) ) diff --git a/R/utils-not-exported.R b/R/utils-not-exported.R index fedb731..e9486ae 100644 --- a/R/utils-not-exported.R +++ b/R/utils-not-exported.R @@ -418,7 +418,7 @@ nest_ifn_tree <- function(data, codes, agents, which = "current", ifn = 4, proce merge(codes, by.x = "Especie", by.y = "species_code") |> merge(agents, by.x = "Agente", by.y = "agent_code") |> dplyr::select( - plot = Estadillo, tree_id = nArbol, ifn3_order = Ordenif3, + plot = Estadillo, tree_id = nArbol, ifn3_order = 6, species_name, d_mm, h_m = Ht, agent_name )