#' Import ForetV2
#'
#' @description Cette fonction importe pour un ou plusieurs départements la base de données ForetV2 de l'IFN.
#' Elle ne nécessite aucum paramètre.
#'
#' @import threadr
#' @import tcltk
#' @import rlist
#'
#' @author Bruciamacchie Max
#'
#' @examples
#' ImportForetV2()
#'
#' @export
#'
ImportForetV2 <- function() {
rep = "ftp://BD_Foret_V1_et_V2_ext:ad3Phequ2Ixae7oh@ftp3.ign.fr/BDFORET_V2"
liste <- list_files_ftp(rep)
debut <- str_locate(liste, pattern ='D0')[,1]
dept <- substr(liste, debut, debut + 3) %>%
list.filter(!is.na(.))
# dept <- substr(liste, 93, 96)
Choix <- tk_select.list(as.character(dept), multiple = TRUE,
title = "ForetV2 : choisir les départements")
dir.create("ForetV2", showWarnings = FALSE)
for (i in 1:length(Choix)) {
url = liste[which(dept == Choix[i])]
download_ftp_file(url, paste0("ForetV2/",Choix[i],".7z"), verbose = TRUE)
}
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.