Downloads georeferenced map images from the Cadastre of Navarre WMS service.
This function wraps mapSpain::esp_get_tiles().
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/sfcobject, 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 toTRUE, it forces a new download.- cache_dir
Path to a cache directory. On
NULL, the function stores cached files in a temporary directory (seebase::tempdir()).- verbose
Logical. If
TRUE, displays informational messages.- crop
Logical. If
TRUE, crop results to the specifiedxextent. Ifxis ansfobject with onePOINT,cropis set toFALSE. Seeterra::crop().- options
A named list containing additional options to pass to the query.
- ...
Arguments passed on to
mapSpain::esp_get_tilesresCharacter string or number. Only valid for WMS providers. Resolution (in pixels) of the final tile.
bbox_expandNumber. Expansion percentage of the bounding box of
x.transparentLogical. Whether to use a transparent background, if supported.
maskLogical.
TRUEto mask the result tox. Seeterra::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
See also
mapSpain::esp_get_tiles()downloads map tiles.terra::RGB()identifies RGB channels.terra::plotRGB()andtidyterra::geom_spatraster_rgb()plot RGB rasters.
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
# \donttest{
bu <- catrnav_wms_get_layer(
c(-1.646812, 42.814528, -1.638036, 42.820320),
srs = 4326,
what = "building"
)
library(mapSpain)
library(ggplot2)
library(tidyterra)
#>
#> Attaching package: ‘tidyterra’
#> The following object is masked from ‘package:stats’:
#>
#> filter
ggplot() +
geom_spatraster_rgb(data = bu)
#> ! `data` has 4 layers. Selecting layers 1, 2, and 3.
# 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)
#> ! `data` has 4 layers. Selecting layers 1, 2, and 3.
# }
