fetchNFI: Fetch SNF Data

fetchNFIR Documentation

Fetch SNF Data

Description

This function can download and decompress data sets from the Spanish National Forest Inventory (SNF) stored in .zip files, whether they are local or remote (URL-based).

Usage

fetchNFI(url., dir = tempdir(), 
    file_ext = c("mdb", 
        "DBF", "accdb"), 
    file_name = NULL, 
    timeOut = timeout(60))

Arguments

url.

character. Specifies the URL/path to a compressed SNF (.zip).

dir

character. Directory where the fetched file will be stored.

file_ext

character. Supported file extensions.

file_name

character. Optional file names inside the decompressed content to keep. It accepts either full file names or bare stems without extensions.

timeOut

request. Maximum request time, see timeout. Default is timeout(60).

Details

The data should be in files with extensions specified in the file_ext argument. Use file_name to restrict the returned files to specific names inside the decompressed content. It accepts either full file names or bare stems without extensions.

Value

character. Returns the path to the fetched and decompressed NFI data (.mdb, .DBF, .accdb, or other extensions requested in file_ext) stored in a temporary file.

Author(s)

Wilson Lara [aut, cre] (ORCID: <https://orcid.org/0000-0003-3527-1380>), Cristobal Ordonez [aut] (ORCID: <https://orcid.org/0000-0001-5354-3760>), Aitor Vázquez-Veloso [aut] (ORCID: <https://orcid.org/0000-0003-0227-506X>), Felipe Bravo [aut] (ORCID: <https://orcid.org/0000-0001-7348-6695>)

Examples

## Process SNF data for Toledo stored locally
# Path to Toledo data file in 'basifoR' package
ifn4p45 <- system.file("Ifn4_Toledo.zip", package="basifoR")

# Decompress SNF data from the specified file path or URL
fetch_ifn4p45 <- fetchNFI(ifn4p45)
print(fetch_ifn4p45)

## French NFI tree table read from the official web resource
## f <- "https://inventaire-forestier.ign.fr/dataifn/data/export_dataifn_2024_en.zip"
## fnfi <- fetchNFI(f, file_ext = "csv", file_name = "ARBRE")
## print(fnfi)

basifoR documentation built on Aug. 26, 2026, 9:06 a.m.

Related to fetchNFI in basifoR...