Title: | Access and Import WMS and WFS Data from Argentine Organizations |
Version: | 1.0.0 |
Description: | Provides functions to retrieve information from Web Feature Service (WFS) and Web Map Service (WMS) layers from various Argentine organizations and import them into R for further analysis. WFS and WMS are standardized protocols for serving georeferenced map data over the internet. For more information on these services, see https://www.ogc.org/publications/standard/wfs/ and https://www.ogc.org/publications/standard/wms/. |
License: | MIT + file LICENSE |
URL: | https://github.com/thomasartopoulos/argentum/, https://thomasartopoulos.github.io/argentum/ |
BugReports: | https://github.com/thomasartopoulos/argentum/issues |
Encoding: | UTF-8 |
RoxygenNote: | 7.3.2 |
VignetteBuilder: | knitr |
Imports: | httr, xml2, sf, readr |
Suggests: | testthat (≥ 3.0.0), mockery, knitr, rmarkdown |
Config/testthat/edition: | 3 |
NeedsCompilation: | no |
Packaged: | 2025-02-13 01:57:47 UTC; tomia |
Author: | Thomas Artopoulos [aut, cre] |
Maintainer: | Thomas Artopoulos <thomas.artopoulos@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2025-02-13 03:30:02 UTC |
Download WFS Layers to Folder
Description
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? |
Details
Download WFS Layers to Folder
Value
Invisibly returns a data frame with download results
Examples
# Get available organizations
orgs <- argentum_list_organizations()
if (nrow(orgs) > 0) {
argentum_download_layers(orgs$Name[1], output_dir = tempdir())
}
Get WMS or WFS Capabilities
Description
Get WMS or WFS Capabilities
Usage
argentum_get_capabilities(url, max_tries = 3, timeout = 30)
Arguments
url |
The full URL of the WMS or WFS service, including all parameters |
max_tries |
The maximum number of attempts to connect |
timeout |
The timeout for each attempt in seconds |
Value
An XML document containing the service capabilities
Examples
try({
capabilities <- argentum_get_capabilities("http://example.com/wfs")
print(capabilities)
})
Import WFS Layer
Description
Import WFS Layer
Usage
argentum_import_wfs_layer(wfs_url, layer_name)
Arguments
wfs_url |
The URL of the WFS service |
layer_name |
The name of the layer to import |
Value
An sf object
Examples
tryCatch({
sf_layer <- argentum_import_wfs_layer("http://example.com/wfs", "example_layer")
print(sf_layer)
}, error = function(e) {
message("Error occurred: ", e$message)
})
Download WFS Layers Interactively
Description
This function provides an interactive interface to download WFS layers. Users can select an organization, choose specific layers or download all, and specify the output format and directory.
Usage
argentum_interactive_download(output_dir = NULL)
Arguments
output_dir |
Optional; Path to the directory where files will be saved. If NULL, user will be prompted |
Details
Download WFS Layers Interactively
Value
Invisibly returns a data frame with download results
Examples
# Try to download interactively
tryCatch({
results <- argentum_interactive_download()
}, error = function(e) {
message("Error: ", e$message)
})
Import WFS Layer Interactively
Description
Import WFS Layer Interactively
Usage
argentum_interactive_import()
Value
An sf object
Examples
sf_layer <- argentum_interactive_import()
List Layers for a Given Organization
Description
This function retrieves and lists the available layers for a specified organization.
Usage
argentum_list_layers(organization)
Arguments
organization |
A character string specifying the name of the organization |
Value
A data frame containing layer information with columns 'Name' and 'Title'
Examples
# This example uses a mock organization name.
# In a real scenario, use an actual organization name from argentum_list_organizations()
tryCatch({
orgs <- argentum_list_organizations()
if(nrow(orgs) > 0) {
layers <- argentum_list_layers(orgs$Name[1])
print(layers)
} else {
message("No organizations found.")
}
}, error = function(e) {
message("Error occurred: ", e$message)
})
List Organizations with WMS and WFS Services
Description
List Organizations with WMS and WFS Services
Usage
argentum_list_organizations()
Value
A data frame containing organization information including WMS and WFS URLs
Select Organization
Description
Select Organization
Usage
argentum_select_organization(search = NULL, interactive_select = interactive())
Arguments
search |
An optional search term to filter organizations |
interactive_select |
Logical; whether to run in interactive mode. Defaults to |
Value
A data frame containing the selected organization's information, or NULL if no selection is made
Examples
# List available organizations
orgs <- argentum_list_organizations()
print(orgs)
# Select organization non-interactively
selected_org <- argentum_select_organization(interactive_select = FALSE)
print(selected_org)
if(interactive()){
# Select an organization interactively
selected_org <- argentum_select_organization()
# Select an organization with a search term
selected_org <- argentum_select_organization("Example")
}
Clean and format URL
Description
Clean and format URL
Usage
clean_url(url)
Arguments
url |
The URL to clean |
Value
A cleaned and formatted URL