Package 'CatastRoNav'

Title: Interface to the 'INSPIRE' Services of the Cadastre of Navarre
Description: Provides access to public spatial data from the Cadastre of Navarre through its 'INSPIRE' Atom feeds, Web Feature Service and Web Map Service endpoints. Supports complete municipal dataset downloads, bounding box feature queries and georeferenced map image downloads for addresses, buildings and cadastral parcels.
Authors: Diego Hernangómez [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-8457-4658>), Francisco J. Goerlich [ctb] (ORCID: <https://orcid.org/0000-0003-1626-525X>)
Maintainer: Diego Hernangómez <[email protected]>
License: GPL-2
Version: 1.0.0
Built: 2026-07-15 13:02:12 UTC
Source: https://github.com/rOpenSpain/CatastRoNav

Help Index


ATOM INSPIRE: download all addresses for a municipality

Description

Downloads spatial data for all addresses in a municipality using the ATOM INSPIRE service provided by the Cadastre of Navarre.

Usage

catrnav_atom_get_address(
  munic,
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

munic

Municipality name, partial name or cadastral code. Use catrnav_atom_search_munic() to search for available municipalities.

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

An sf object, or NULL if the data cannot be retrieved.

Source

SITNA – Catastro de Navarra

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address_db_all(), catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all(), catrnav_atom_search_munic()

Work with cadastral addresses: catrnav_atom_get_address_db_all(), catrnav_wfs_get_address_bbox(), catrnav_wms_get_layer()

Examples

s <- catrnav_atom_get_address("Tudela")

library(ggplot2)

ggplot(s) +
  geom_sf() +
  labs(
    title = "Addresses",
    subtitle = "Tudela"
  )

ATOM INSPIRE: list address download URLs

Description

Creates a table of URLs provided by the Cadastre of Navarre ATOM INSPIRE service for downloading addresses by municipality.

Usage

catrnav_atom_get_address_db_all(
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

A tibble with the requested information in the following columns:

  • munic: Municipality name and cadastral code.

  • url: ATOM URL for the corresponding municipality.

  • date: Reference date of the data.

Source

SITNA – Catastro de Navarra

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address(), catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all(), catrnav_atom_search_munic()

Work with cadastral addresses: catrnav_atom_get_address(), catrnav_wfs_get_address_bbox(), catrnav_wms_get_layer()

Examples

catrnav_atom_get_address_db_all()

ATOM INSPIRE: download all buildings for a municipality

Description

Downloads spatial data for all buildings in a municipality using the ATOM INSPIRE service provided by the Cadastre of Navarre.

Usage

catrnav_atom_get_buildings(
  munic,
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

munic

Municipality name, partial name or cadastral code. Use catrnav_atom_search_munic() to search for available municipalities.

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

An sf object, or NULL if the data cannot be retrieved.

Source

SITNA – Catastro de Navarra

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_atom_get_buildings_db_all(), catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all(), catrnav_atom_search_munic()

Work with cadastral buildings: catrnav_atom_get_buildings_db_all(), catrnav_wfs_get_buildings_bbox(), catrnav_wms_get_layer()

Examples

s <- catrnav_atom_get_buildings("Iruña")

library(ggplot2)

ggplot(s) +
  geom_sf() +
  labs(
    title = "Buildings",
    subtitle = "Pamplona / Iruña"
  )

ATOM INSPIRE: list building download URLs

Description

Creates a table of URLs provided by the Cadastre of Navarre ATOM INSPIRE service for downloading buildings by municipality.

Usage

catrnav_atom_get_buildings_db_all(
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

A tibble with the requested information in the following columns:

  • munic: Municipality name and cadastral code.

  • url: ATOM URL for the corresponding municipality.

  • date: Reference date of the data.

Source

SITNA – Catastro de Navarra

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_atom_get_buildings(), catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all(), catrnav_atom_search_munic()

Work with cadastral buildings: catrnav_atom_get_buildings(), catrnav_wfs_get_buildings_bbox(), catrnav_wms_get_layer()

Examples

catrnav_atom_get_buildings_db_all()

ATOM INSPIRE: download all cadastral parcels for a municipality

Description

Downloads spatial data for all cadastral parcels in a municipality using the ATOM INSPIRE service provided by the Cadastre of Navarre.

Usage

catrnav_atom_get_parcels(
  munic,
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

munic

Municipality name, partial name or cadastral code. Use catrnav_atom_search_munic() to search for available municipalities.

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

An sf object, or NULL if the data cannot be retrieved.

Source

SITNA – Catastro de Navarra

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_atom_get_parcels_db_all(), catrnav_atom_search_munic()

Work with cadastral parcels: catrnav_atom_get_parcels_db_all(), catrnav_wfs_get_parcels_bbox(), catrnav_wms_get_layer()

Examples

s <- catrnav_atom_get_parcels("Iruña")

library(ggplot2)

ggplot(s) +
  geom_sf() +
  labs(
    title = "Cadastral Zoning",
    subtitle = "Pamplona / Iruña"
  )

ATOM INSPIRE: list cadastral parcel download URLs

Description

Creates a table of URLs provided by the Cadastre of Navarre ATOM INSPIRE service for downloading cadastral parcels by municipality.

Usage

catrnav_atom_get_parcels_db_all(
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

A tibble with the requested information in the following columns:

  • munic: Municipality name and cadastral code.

  • url: ATOM URL for the corresponding municipality.

  • date: Reference date of the data.

Source

SITNA – Catastro de Navarra

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_atom_get_parcels(), catrnav_atom_search_munic()

Work with cadastral parcels: catrnav_atom_get_parcels(), catrnav_wfs_get_parcels_bbox(), catrnav_wms_get_layer()

Examples

catrnav_atom_get_parcels_db_all()

ATOM INSPIRE: search for municipalities

Description

Searches for a municipality by name or cadastral code in the Cadastre of Navarre ATOM index.

Usage

catrnav_atom_search_munic(
  munic,
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE
)

Arguments

munic

Municipality name, partial name or cadastral code to search for.

cache

A logical value indicating whether to use cached files. Defaults to TRUE.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

Value

A tibble with the municipality name and cadastral code, or NULL if no match is found.

See Also

Download data from the ATOM INSPIRE service: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all()

Examples

catrnav_atom_search_munic("Pamplona")

Clear your CatastRoNav cache directory

Description

Use this function with caution. It clears cached data and configuration, specifically:

  • Deletes the CatastRoNav configuration directory (tools::R_user_dir("CatastRoNav", "config")).

  • Deletes the cache_dir directory.

  • Clears the CATASTRONAV_CACHE_DIR environment variable.

Usage

catrnav_clear_cache(config = FALSE, cached_data = TRUE, verbose = FALSE)

Arguments

config

A logical value indicating whether to delete the CatastRoNav configuration directory.

cached_data

If TRUE, deletes your cache_dir and all its contents.

verbose

Logical. If TRUE, displays informational messages.

Details

This function resets the cache state as if you had never used CatastRoNav.

Value

NULL, invisibly. This function is called for its side effects.

See Also

Manage the local cache: catrnav_set_cache_dir()

Examples

# Caution! This modifies your current state.
## Not run: 
my_cache <- catrnav_detect_cache_dir()

example_cache <- file.path(tempdir(), "example", "cache")
catrnav_set_cache_dir(example_cache, verbose = FALSE)

catrnav_clear_cache(verbose = TRUE)

# Restore the initial cache.
catrnav_set_cache_dir(my_cache)
identical(my_cache, catrnav_detect_cache_dir())

## End(Not run)

Set your CatastRoNav cache directory

Description

Configures the cache directory used by CatastRoNav. Use Sys.getenv("CATASTRONAV_CACHE_DIR") or catrnav_detect_cache_dir() to inspect the current path.

Usage

catrnav_set_cache_dir(
  cache_dir = NULL,
  overwrite = FALSE,
  install = FALSE,
  verbose = TRUE
)

catrnav_detect_cache_dir()

Arguments

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

overwrite

A logical value indicating whether to overwrite an existing CATASTRONAV_CACHE_DIR value.

install

Logical. If TRUE, installs the key on your local machine for use in future sessions. Defaults to FALSE. If cache_dir is FALSE, this argument is set to FALSE automatically.

verbose

Logical. If TRUE, displays informational messages.

Details

By default, when no cache_dir is set, CatastRoNav uses a directory inside base::tempdir(). Files in this directory are temporary and are removed when the R session ends. To persist a cache across R sessions, use catrnav_set_cache_dir(cache_dir, install = TRUE). This writes the chosen path to a configuration file under tools::R_user_dir("CatastRoNav", "config").

Value

catrnav_set_cache_dir() invisibly returns the cache path as a character string. It is primarily called for its side effect.

catrnav_detect_cache_dir() returns the cache path used in the current session.

Caching strategies

Source files are cached after download. CatastRoNav implements the following caching options:

  • For occasional use, rely on the default tempdir()-based cache without installing a persistent path.

  • Modify the cache for a single session by setting catrnav_set_cache_dir(cache_dir = "a/path/here").

  • For reproducible workflows, install a persistent cache with catrnav_set_cache_dir(cache_dir = "a/path/here", install = TRUE). This cache is kept across R sessions.

  • To cache specific files elsewhere, use the cache_dir argument in the corresponding function.

Cached files can occasionally become corrupt. In that case, download the data again by setting update_cache = TRUE in the corresponding function.

If a download fails, use verbose = TRUE to inspect the request and catrnav_detect_cache_dir() to identify the active cache path.

Note

The configuration location has moved from rappdirs::user_config_dir("CatastRoNav", "R") to tools::R_user_dir("CatastRoNav", "config"). Existing configuration files are migrated automatically. A migration message is shown only once.

See Also

Manage the local cache: catrnav_clear_cache()

Examples

# Caution! This modifies your current state.
## Not run: 
my_cache <- catrnav_detect_cache_dir()

example_cache <- file.path(tempdir(), "example", "cache")
catrnav_set_cache_dir(example_cache)

catrnav_detect_cache_dir()

# Restore the initial cache.
catrnav_set_cache_dir(my_cache)
identical(my_cache, catrnav_detect_cache_dir())

## End(Not run)

catrnav_detect_cache_dir()

WFS INSPIRE: retrieve addresses

Description

Retrieves spatial address data from the Cadastre of Navarre WFS INSPIRE service. catrnav_wfs_get_address_bbox() retrieves features within the supplied bounding box. See Bounding box.

Usage

catrnav_wfs_get_address_bbox(x, srs = 4326, verbose = FALSE, count = NULL)

Arguments

x

See Bounding box. Can be one of:

  • A numeric vector of length 4 with the coordinates that define the bounding box: c(xmin, ymin, xmax, ymax).

  • A sf/sfc object, as provided by the sf package.

srs

CRS to use for the query. Defaults to 4326. See Bounding box.

verbose

Logical. If TRUE, displays informational messages.

count

Positive whole number specifying the maximum number of features to return. If NULL, the service default applies.

Value

An sf object, or NULL if the data cannot be retrieved.

API limits

The service returns a maximum of 5,000 features by default. Use count to request a smaller result.

Bounding box

When x is a numeric vector, make sure that srs matches the coordinate values. The function queries the bounding box in EPSG:25830, ETRS89 / UTM zone 30N, then transforms the result back to srs.

When x is an sf or sfc object, srs is ignored. The object's bounding box is used for the query and the result is transformed back to the input CRS. See sf::st_bbox().

Source

SITNA – Catastro de Navarra

See Also

Query data from the WFS INSPIRE service: catrnav_wfs_get_buildings_bbox(), catrnav_wfs_get_parcels_bbox()

Work with cadastral addresses: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_wms_get_layer()

Examples

downtown <- c(-1.646812, 42.814528, -1.638036, 42.820320)

ad <- catrnav_wfs_get_address_bbox(downtown, srs = 4326)

library(ggplot2)

ggplot(ad) +
  geom_sf()

WFS INSPIRE: retrieve buildings

Description

Retrieves spatial building data from the Cadastre of Navarre WFS INSPIRE service. catrnav_wfs_get_buildings_bbox() retrieves features within the supplied bounding box. See Bounding box.

Usage

catrnav_wfs_get_buildings_bbox(x, srs = 4326, verbose = FALSE, count = NULL)

Arguments

x

See Bounding box. Can be one of:

  • A numeric vector of length 4 with the coordinates that define the bounding box: c(xmin, ymin, xmax, ymax).

  • A sf/sfc object, as provided by the sf package.

srs

CRS to use for the query. Defaults to 4326. See Bounding box.

verbose

Logical. If TRUE, displays informational messages.

count

Positive whole number specifying the maximum number of features to return. If NULL, the service default applies.

Value

An sf object, or NULL if the data cannot be retrieved.

API limits

The service returns a maximum of 5,000 features by default. Use count to request a smaller result.

Bounding box

When x is a numeric vector, make sure that srs matches the coordinate values. The function queries the bounding box in EPSG:25830, ETRS89 / UTM zone 30N, then transforms the result back to srs.

When x is an sf or sfc object, srs is ignored. The object's bounding box is used for the query and the result is transformed back to the input CRS. See sf::st_bbox().

Source

SITNA – Catastro de Navarra

See Also

Query data from the WFS INSPIRE service: catrnav_wfs_get_address_bbox(), catrnav_wfs_get_parcels_bbox()

Work with cadastral buildings: catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_wms_get_layer()

Examples

downtown <- c(-1.646812, 42.814528, -1.638036, 42.820320)

bu <- catrnav_wfs_get_buildings_bbox(downtown, srs = 4326)

library(ggplot2)

ggplot(bu) +
  geom_sf()

WFS INSPIRE: retrieve cadastral parcels

Description

Retrieves spatial cadastral parcel data from the Cadastre of Navarre WFS INSPIRE service. catrnav_wfs_get_parcels_bbox() retrieves features within the supplied bounding box. See Bounding box.

Usage

catrnav_wfs_get_parcels_bbox(x, srs = 4326, verbose = FALSE, count = NULL)

Arguments

x

See Bounding box. Can be one of:

  • A numeric vector of length 4 with the coordinates that define the bounding box: c(xmin, ymin, xmax, ymax).

  • A sf/sfc object, as provided by the sf package.

srs

CRS to use for the query. Defaults to 4326. See Bounding box.

verbose

Logical. If TRUE, displays informational messages.

count

Positive whole number specifying the maximum number of features to return. If NULL, the service default applies.

Value

An sf object, or NULL if the data cannot be retrieved.

API limits

The service returns a maximum of 5,000 features by default. Use count to request a smaller result.

Bounding box

When x is a numeric vector, make sure that srs matches the coordinate values. The function queries the bounding box in EPSG:25830, ETRS89 / UTM zone 30N, then transforms the result back to srs.

When x is an sf or sfc object, srs is ignored. The object's bounding box is used for the query and the result is transformed back to the input CRS. See sf::st_bbox().

Source

SITNA – Catastro de Navarra

See Also

Query data from the WFS INSPIRE service: catrnav_wfs_get_address_bbox(), catrnav_wfs_get_buildings_bbox()

Work with cadastral parcels: catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all(), catrnav_wms_get_layer()

Examples

downtown <- c(-1.646812, 42.814528, -1.638036, 42.820320)

cp <- catrnav_wfs_get_parcels_bbox(downtown, srs = 4326)

library(ggplot2)

ggplot(cp) +
  geom_sf()

WMS INSPIRE: download georeferenced map images

Description

Downloads georeferenced map images from the Cadastre of Navarre WMS service. This function wraps mapSpain::esp_get_tiles().

Usage

catrnav_wms_get_layer(
  x,
  srs = 4326,
  what = c("building", "parcel", "address"),
  styles = c("default", "ELFCadastre"),
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE,
  crop = FALSE,
  options = NULL,
  ...
)

Arguments

x

See Bounding box. Can be one of:

  • A numeric vector of length 4 with the coordinates that define the bounding box: c(xmin, ymin, xmax, ymax).

  • A sf/sfc object, as provided by the sf package.

srs

CRS to use for the query. Defaults to 4326. See Bounding box.

what

WMS layer to download. See Layers and styles.

styles

Style to apply to the selected WMS layer. See Layers and styles.

update_cache

Logical. Should the cached file be refreshed? Defaults to FALSE. When set to TRUE, it forces a new download.

cache_dir

Path to a cache directory. On NULL, the function stores cached files in a temporary directory (see base::tempdir()).

verbose

Logical. If TRUE, displays informational messages.

crop

Logical. If TRUE, crop results to the specified x extent. If x is an sf object with one POINT, crop is set to FALSE. See terra::crop().

options

A named list containing additional options to pass to the query.

...

Arguments passed on to mapSpain::esp_get_tiles

res

Character string or number. Only valid for WMS providers. Resolution (in pixels) of the final tile.

bbox_expand

Number. Expansion percentage of the bounding box of x.

transparent

Logical. Whether to use a transparent background, if supported.

mask

Logical. TRUE to mask the result to x. See terra::mask().

Value

A SpatRaster with three RGB or four RGBA layers, or NULL when the request cannot be completed. See terra::RGB().

Bounding box

When x is a numeric vector, make sure that srs matches the coordinate values. When x is an sf or sfc object, srs is ignored.

The query uses EPSG:3857, Web Mercator, then transforms the image back to the input CRS. If the image appears distorted, provide a spatial object as x or set srs to the CRS of the requested image.

Layers and styles

Layers

The what argument selects one of the following API layers:

  • "parcel": CP.CadastralParcel.

  • "building": BU.Building.

  • "address": AD.Address.

Styles

The WMS service provides different styles for each layer (what argument). Available styles include:

  • "parcel": "default" and "ELFCadastre".

  • "building": "default".

  • "address": "default".

Source

SITNA – Catastro de Navarra

See Also

Work with cadastral addresses: catrnav_atom_get_address(), catrnav_atom_get_address_db_all(), catrnav_wfs_get_address_bbox()

Work with cadastral buildings: catrnav_atom_get_buildings(), catrnav_atom_get_buildings_db_all(), catrnav_wfs_get_buildings_bbox()

Work with cadastral parcels: catrnav_atom_get_parcels(), catrnav_atom_get_parcels_db_all(), catrnav_wfs_get_parcels_bbox()

Examples

bu <- catrnav_wms_get_layer(
  c(-1.646812, 42.814528, -1.638036, 42.820320),
  srs = 4326,
  what = "building"
)

library(mapSpain)
library(ggplot2)
library(tidyterra)

ggplot() +
  geom_spatraster_rgb(data = bu)

# Parcels
parc <- catrnav_wms_get_layer(
  c(-1.646812, 42.814528, -1.638036, 42.820320),
  srs = 4326,
  what = "parcel"
)

ggplot() +
  geom_spatraster_rgb(data = parc)