inspire_wfs_get: Query WFS INSPIRE services

View source: R/utils-wfs.R

inspire_wfs_getR Documentation

Query WFS INSPIRE services

Description

Build and run a WFS INSPIRE request. This function supports the package's WFS functions and is also available for querying other cadastral or INSPIRE resources.

Usage

inspire_wfs_get(
  scheme = "https",
  hostname = "ovc.catastro.meh.es",
  path = "INSPIRE/wfsCP.aspx",
  query = list(),
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

scheme

Character string specifying the protocol used to access the resource.

hostname

Character string specifying the resource host.

path

Character string specifying the resource path on the host.

query

Named list of query parameters and their values.

cache_dir

Path to a cache directory. If NULL or FALSE, the function stores cached files in a temporary directory. See base::tempdir().

verbose

Logical. Whether to display informational messages.

Details

This function constructs a request URL from its components, downloads the result to the cache directory and reports WFS exceptions. See Examples.

Value

A character string containing the downloaded file path. Returns NULL if the request fails.

See Also

Query WFS INSPIRE services: catr_wfs_get_address_bbox(), catr_wfs_get_buildings_bbox(), catr_wfs_get_parcels_bbox()

Examples


# Access the Cadastre of Navarre.
# See also https://ropenspain.github.io/CatastRoNav/

file_local <- inspire_wfs_get(
  hostname = "inspire.navarra.es",
  path = "services/BU/wfs",
  query = list(
    service = "WFS",
    request = "getfeature",
    typenames = "BU:Building",
    bbox = "609800,4740100,611000,4741300",
    SRSNAME = "EPSG:25830"
  )
)

if (!is.null(file_local)) {
  pamp <- sf::read_sf(file_local)

  if (requireNamespace("ggplot2", quietly = TRUE)) {
    library(ggplot2)
    ggplot(pamp) +
      geom_sf()
  }
}


CatastRo documentation built on Oct. 5, 2026, 5:07 p.m.