WFS (Web Feature Service) and WMS (Web Map Service) are standardized protocols for serving georeferenced map data over the internet:
When you use Argentum to import WFS layers, you’re getting actual vector data that you can analyze and manipulate in R:
library(Argentum)
library(sf)
# Get organization data
org <- argentum_select_organization(search = "Buenos Aires")
# List available layers
layers <- argentum_list_layers(org$Name)
# Import a specific layer
sf_layer <- argentum_import_wfs_layer(org$WFS_URL, layers$Name[1])
# Now you can work with the data using sf functions
st_crs(sf_layer) # Check the coordinate reference system
plot(sf_layer) # Basic plot of the geometry
Before importing data, you can check what capabilities a service offers:
Always implement proper error handling:
When working with WFS services:
After importing WFS data:
library(sf)
library(dplyr)
# Check the data structure
str(sf_layer)
# Basic statistics
summary(sf_layer)
# Spatial operations
sf_layer_transformed <- st_transform(sf_layer, 4326)
# Calculate areas if working with polygons
if (all(st_geometry_type(sf_layer) %in% c("POLYGON", "MULTIPOLYGON"))) {
sf_layer$area <- st_area(sf_layer)
}
While Argentum provides high-level functions, you can also work with WFS services directly:
Common issues and solutions:
argentum_list_layers()
to get exact layer
namesPlanned features for future versions:
sessionInfo()
#> R version 4.3.1 (2023-06-16 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19045)
#>
#> Matrix products: default
#>
#>
#> locale:
#> [1] LC_COLLATE=C LC_CTYPE=Spanish_Argentina.utf8
#> [3] LC_MONETARY=Spanish_Argentina.utf8 LC_NUMERIC=C
#> [5] LC_TIME=Spanish_Argentina.utf8
#>
#> time zone: America/Buenos_Aires
#> tzcode source: internal
#>
#> attached base packages:
#> [1] stats graphics grDevices utils datasets methods base
#>
#> loaded via a namespace (and not attached):
#> [1] digest_0.6.37 R6_2.5.1 fastmap_1.2.0 xfun_0.50
#> [5] cachem_1.1.0 knitr_1.49 htmltools_0.5.8.1 rmarkdown_2.29
#> [9] lifecycle_1.0.4 cli_3.6.1 sass_0.4.9 jquerylib_0.1.4
#> [13] compiler_4.3.1 rstudioapi_0.17.1 tools_4.3.1 evaluate_1.0.3
#> [17] bslib_0.8.0 yaml_2.3.10 rlang_1.1.1 jsonlite_1.8.9