Skip to contents

This function downloads WFS layers from specified organizations to a local folder. It can download all layers from an organization or specific layers by name.

Usage

argentum_download_layers(
  organization,
  output_dir = file.path(tempdir(), "wfs_layers"),
  layer_names = NULL,
  format = c("gpkg", "shp", "geojson"),
  overwrite = FALSE
)

Arguments

organization

A character string specifying the name of the organization

output_dir

Path to the directory where files will be saved. Defaults to a temporary directory.

layer_names

Optional vector of layer names to download. If NULL, downloads all available layers

format

Output format for the files. One of "gpkg" (GeoPackage), "shp" (Shapefile), or "geojson" (GeoJSON)

overwrite

Logical; should existing files be overwritten?

Value

Invisibly returns a data frame with download results

Details

Download WFS Layers to Folder

Examples

# \donttest{
# Get available organizations
orgs <- argentum_list_organizations()
if (nrow(orgs) > 0) {
  argentum_download_layers(orgs$Name[1], output_dir = tempdir())
}
#> Attempting to connect to WFS URL: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetCapabilities
#> Requesting capabilities from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetCapabilities
#> Downloading layer: Localidades:Centro_huellas_localidades
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3ACentro_huellas_localidades&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:Centro_huellas_localidades to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.Centro_huellas_localidades.gpkg
#> Downloading layer: Localidades:Cuyo_huellas_localidades
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3ACuyo_huellas_localidades&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:Cuyo_huellas_localidades to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.Cuyo_huellas_localidades.gpkg
#> Downloading layer: Localidades:NEA_huellas_localidades
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3ANEA_huellas_localidades&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:NEA_huellas_localidades to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.NEA_huellas_localidades.gpkg
#> Downloading layer: Localidades:NOA_huellas_localidades
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3ANOA_huellas_localidades&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:NOA_huellas_localidades to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.NOA_huellas_localidades.gpkg
#> Downloading layer: Localidades:PatagoniaNorte_huellas_localidades
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3APatagoniaNorte_huellas_localidades&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:PatagoniaNorte_huellas_localidades to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.PatagoniaNorte_huellas_localidades.gpkg
#> Downloading layer: Localidades:PatagoniaSur_huellas_localidades
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3APatagoniaSur_huellas_localidades&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:PatagoniaSur_huellas_localidades to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.PatagoniaSur_huellas_localidades.gpkg
#> Downloading layer: Localidades:imagenes_disponibles
#> Requesting WFS feature from: https://geotematico01.conae.gov.ar/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typeName=Localidades%3Aimagenes_disponibles&outputFormat=application%2Fjson
#> Successfully downloaded Localidades:imagenes_disponibles to C:\Users\tomia\AppData\Local\Temp\RtmpoZBdzp/Localidades.imagenes_disponibles.gpkg
#> 
#> Download Summary:
#> - Total layers processed: 7
#> - Successfully downloaded: 7
#> - Errors: 0
#> - Skipped: 0
# }