Title: | Interface to the API 'Sede Electronica Del Catastro' |
---|---|
Description: | Access public spatial data available under the 'INSPIRE' directive. Tools for downloading references and addresses of properties, as well as map images. |
Authors: | Ángel Delgado Panadero [aut, cph] , Iñaki Ucar [ctb] , Diego Hernangómez [aut, cre] |
Maintainer: | Diego Hernangómez <[email protected]> |
License: | GPL-2 |
Version: | 0.4.0 |
Built: | 2024-11-21 14:23:48 UTC |
Source: | https://github.com/rOpenSpain/CatastRo |
Get the spatial data of all the addresses belonging to a single municipality
using the INSPIRE ATOM service. Additionally, the function also returns the
corresponding street information on the fields with the prefix tfname_*
.
catr_atom_get_address( munic, to = NULL, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_get_address( munic, to = NULL, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
munic |
Municipality to extract, It can be a part of a string or the
cadastral code. See |
to |
Optional parameter for defining the Territorial Office to which
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
A sf
object.
INSPIRE Services for Cadastral Cartography.
INSPIRE API functions:
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE ATOM services:
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
Other addresses:
catr_atom_get_address_db_all()
,
catr_wfs_get_address_bbox()
Other spatial:
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
s <- catr_atom_get_address("Melque", to = "Segovia" ) library(ggplot2) ggplot(s) + geom_sf(aes(color = specification)) + coord_sf( xlim = c(376200, 376850), ylim = c(4545000, 4546000) ) + labs( title = "Addresses", subtitle = "Melque de Cercos, Segovia" )
s <- catr_atom_get_address("Melque", to = "Segovia" ) library(ggplot2) ggplot(s) + geom_sf(aes(color = specification)) + coord_sf( xlim = c(376200, 376850), ylim = c(4545000, 4546000) ) + labs( title = "Addresses", subtitle = "Melque de Cercos, Segovia" )
Create a database containing the urls provided in the INSPIRE ATOM service of the Spanish Cadastre for extracting Addresses.
catr_atom_get_address_db_all()
provides a top-level table including
information of all the territorial offices (except Basque Country and
Navarre) listing the municipalities included on each office.
catr_atom_get_address_db_to()
provides a table for the specified
territorial office including information for each of the municipalities
of that office.
catr_atom_get_address_db_all( cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE ) catr_atom_get_address_db_to( to, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_get_address_db_all( cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE ) catr_atom_get_address_db_to( to, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
to |
Territorial office. It can be any type of string, the function
would perform a search using |
A tibble
with the information requested.
catr_atom_get_address_db_all()
includes the following fields:
territorial_office
: Territorial office, corresponding to each province
of Spain expect Basque Country and Navarre.
url
: ATOM url for the corresponding territorial office.
munic
: Name of the municipality.
date
: Reference date of the data. Note that the information of
this service is updated twice a year.
catr_atom_get_address_db_to()
includes the following fields:
munic
: Name of the municipality.
url
: url for downloading information of the corresponding municipality.
date
: Reference date of the data. Note that the information of
this service is updated twice a year.
https://www.catastro.hacienda.gob.es/INSPIRE/Addresses/ES.SDGC.AD.atom.xml
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE ATOM services:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
Other addresses:
catr_atom_get_address()
,
catr_wfs_get_address_bbox()
Other databases:
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
,
catr_srs_values
catr_atom_get_address_db_all()
catr_atom_get_address_db_all()
Get the spatial data of all the buildings belonging to a single municipality using the INSPIRE ATOM service.
catr_atom_get_buildings( munic, to = NULL, what = c("building", "buildingpart", "other"), cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_get_buildings( munic, to = NULL, what = c("building", "buildingpart", "other"), cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
munic |
Municipality to extract, It can be a part of a string or the
cadastral code. See |
to |
Optional parameter for defining the Territorial Office to which
|
what |
Information to load. It could be:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
A sf
object.
INSPIRE Services for Cadastral Cartography.
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE ATOM services:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
Other buildings:
catr_atom_get_buildings_db_all()
,
catr_wfs_get_buildings_bbox()
Other spatial:
catr_atom_get_address()
,
catr_atom_get_parcels()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
s <- catr_atom_get_buildings("Nava de la Asuncion", to = "Segovia", what = "building" ) library(ggplot2) ggplot(s) + geom_sf() + coord_sf( xlim = c(374500, 375500), ylim = c(4556500, 4557500) ) + labs( title = "Buildings", subtitle = "Nava de la Asuncion, Segovia" )
s <- catr_atom_get_buildings("Nava de la Asuncion", to = "Segovia", what = "building" ) library(ggplot2) ggplot(s) + geom_sf() + coord_sf( xlim = c(374500, 375500), ylim = c(4556500, 4557500) ) + labs( title = "Buildings", subtitle = "Nava de la Asuncion, Segovia" )
Create a database containing the urls provided in the INSPIRE ATOM service of the Spanish Cadastre for extracting buildings.
catr_atom_get_buildings_db_all()
provides a top-level table including
information of all the territorial offices (except Basque Country and
Navarre) listing the municipalities included on each office.
catr_atom_get_buildings_db_to()
provides a table for the specified
territorial office including information for each of the municipalities
of that office.
catr_atom_get_buildings_db_all( cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE ) catr_atom_get_buildings_db_to( to, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_get_buildings_db_all( cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE ) catr_atom_get_buildings_db_to( to, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
to |
Territorial office. It can be any type of string, the function
would perform a search using |
A tibble
with the information requested.
catr_atom_get_buildings_db_all()
includes the following fields:
territorial_office
: Territorial office, corresponding to each province
of Spain expect Basque Country and Navarre.
url
: ATOM url for the corresponding territorial office.
munic
: Name of the municipality.
date
: Reference date of the data. Note that the information of
this service is updated twice a year.
catr_atom_get_buildings_db_to()
includes the following fields:
munic
: Name of the municipality.
url
: url for downloading information of the corresponding municipality.
date
: Reference date of the data. Note that the information of
this service is updated twice a year.
https://www.catastro.hacienda.gob.es/INSPIRE/buildings/ES.SDGC.BU.atom.xml
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE ATOM services:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
Other buildings:
catr_atom_get_buildings()
,
catr_wfs_get_buildings_bbox()
Other databases:
catr_atom_get_address_db_all()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
,
catr_srs_values
catr_atom_get_buildings_db_all()
catr_atom_get_buildings_db_all()
Get the spatial data of all the cadastral parcels belonging to a single municipality using the INSPIRE ATOM service.
catr_atom_get_parcels( munic, to = NULL, what = "parcel", cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_get_parcels( munic, to = NULL, what = "parcel", cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
munic |
Municipality to extract, It can be a part of a string or the
cadastral code. See |
to |
Optional parameter for defining the Territorial Office to which
|
what |
Information to load. It could be |
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
A sf
object.
INSPIRE Services for Cadastral Cartography.
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE ATOM services:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
Other parcels:
catr_atom_get_parcels_db_all()
,
catr_wfs_get_parcels_bbox()
Other spatial:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
s <- catr_atom_get_parcels("Melque", to = "Segovia", what = "parcel" ) library(ggplot2) ggplot(s) + geom_sf() + labs( title = "Cadastral Zoning", subtitle = "Melque de Cercos, Segovia" )
s <- catr_atom_get_parcels("Melque", to = "Segovia", what = "parcel" ) library(ggplot2) ggplot(s) + geom_sf() + labs( title = "Cadastral Zoning", subtitle = "Melque de Cercos, Segovia" )
Create a database containing the urls provided in the INSPIRE ATOM service of the Spanish Cadastre for extracting cadastral parcels.
catr_atom_get_parcels_db_all()
provides a top-level table including
information of all the territorial offices (except Basque Country and
Navarre) listing the municipalities included on each office.
catr_atom_get_parcels_db_to()
provides a table for the specified
territorial office including information for each of the municipalities
of that office.
catr_atom_get_parcels_db_all( cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE ) catr_atom_get_parcels_db_to( to, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_get_parcels_db_all( cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE ) catr_atom_get_parcels_db_to( to, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
to |
Territorial office. It can be any type of string, the function
would perform a search using |
A tibble
with the information requested.
catr_atom_get_parcels_db_all()
includes the following fields:
territorial_office
: Territorial office, corresponding to each province
of Spain expect Basque Country and Navarre.
url
: ATOM url for the corresponding territorial office.
munic
: Name of the municipality.
date
: Reference date of the data. Note that the information of
this service is updated twice a year.
catr_atom_get_parcels_db_to()
includes the following fields:
munic
: Name of the municipality.
url
: url for downloading information of the corresponding municipality.
date
: Reference date of the data. Note that the information of
this service is updated twice a year.
https://www.catastro.hacienda.gob.es/INSPIRE/CadastralParcels/ES.SDGC.CP.atom.xml
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE ATOM services:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_search_munic()
Other parcels:
catr_atom_get_parcels()
,
catr_wfs_get_parcels_bbox()
Other databases:
catr_atom_get_address_db_all()
,
catr_atom_get_buildings_db_all()
,
catr_atom_search_munic()
,
catr_srs_values
catr_atom_get_parcels_db_all()
catr_atom_get_parcels_db_all()
Search for a municipality (as a string, part of string or code) and get the corresponding coding as per the Cadastre.
catr_atom_search_munic( munic, to = NULL, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
catr_atom_search_munic( munic, to = NULL, cache = TRUE, update_cache = FALSE, cache_dir = NULL, verbose = FALSE )
munic |
Municipality to extract, It can be a part of a string or the cadastral code. |
to |
Optional parameter for defining the Territorial Office to which
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
A tibble
.
Other INSPIRE ATOM services:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
Other search:
catr_get_code_from_coords()
,
catr_ovc_get_cod_munic()
,
catr_ovc_get_cod_provinces()
Other databases:
catr_atom_get_address_db_all()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels_db_all()
,
catr_srs_values
catr_atom_search_munic("Mad")
catr_atom_search_munic("Mad")
Use this function with caution. This function would clear your cached data and configuration, specifically:
Deletes the CatastRo config directory
(rappdirs::user_config_dir("CatastRo", "R")
).
Deletes the cache_dir
directory.
Deletes the values on stored on Sys.getenv("CATASTROESP_CACHE_DIR")
.
catr_clear_cache(config = FALSE, cached_data = TRUE, verbose = FALSE)
catr_clear_cache(config = FALSE, cached_data = TRUE, verbose = FALSE)
config |
if |
cached_data |
If this is set to |
verbose |
Logical, displays information. Useful for debugging,
default is |
This is an overkill function that is intended to reset your status as it you would never have installed and/or used CatastRo.
Invisible. This function is called for its side effects.
Other cache utilities:
catr_set_cache_dir()
# Don't run this! It would modify your current state ## Not run: catr_clear_cache(verbose = TRUE) ## End(Not run) Sys.getenv("CATASTROESP_CACHE_DIR")
# Don't run this! It would modify your current state ## Not run: catr_clear_cache(verbose = TRUE) ## End(Not run) Sys.getenv("CATASTROESP_CACHE_DIR")
This function takes as an input a pair of coordinates of a sf
object and returns the corresponding municipality code for that coordinates.
See also mapSpain::esp_get_munic_siane()
and catr_ovc_get_cod_munic()
.
catr_get_code_from_coords(x, srs, verbose = FALSE, cache_dir = NULL, ...)
catr_get_code_from_coords(x, srs, verbose = FALSE, cache_dir = NULL, ...)
x |
It could be:
|
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
verbose |
Logical, displays information. Useful for debugging,
default is |
cache_dir |
A path to a cache directory. On |
... |
Arguments passed on to
|
When x
is a numeric vector, make sure that the srs
matches the
coordinate values.
When x
is a sf
object, only the first value would
be used. The function would extract the coordinates using
sf::st_centroid(x, of_largest_polygon = TRUE)
.
A tibble
with the format described in
catr_ovc_get_cod_munic()
.
mapSpain::esp_get_munic_siane()
, sf::st_centroid()
.
Other search:
catr_atom_search_munic()
,
catr_ovc_get_cod_munic()
,
catr_ovc_get_cod_provinces()
# Use with coords catr_get_code_from_coords(c(-16.25462, 28.46824), srs = 4326) # Use with sf prov <- mapSpain::esp_get_prov("Caceres") catr_get_code_from_coords(prov)
# Use with coords catr_get_code_from_coords(c(-16.25462, 28.46824), srs = 4326) # Use with sf prov <- mapSpain::esp_get_prov("Caceres") catr_get_code_from_coords(prov)
Implementation of the OVCCallejero service ConsultaMunicipioCodigos.
Return the names and codes of a municipality. Returns both the codes as per the Cadastre and as per the INE (National Statistics Institute).
catr_ovc_get_cod_munic(cpro, cmun = NULL, cmun_ine = NULL, verbose = FALSE)
catr_ovc_get_cod_munic(cpro, cmun = NULL, cmun_ine = NULL, verbose = FALSE)
cpro |
The code of a province, as provided by
|
cmun |
Code of a municipality, as recorded on the Spanish Cadastre. |
cmun_ine |
Code of a municipality, as recorded on National Statistics Institute. See INE: List of municipalities |
verbose |
Logical, displays information. Useful for debugging,
default is |
Parameter cpro
is mandatory. Either cmun
or cmun_ine
should be
provided.
On a successful query, the function returns a tibble
with one row including the following columns:
munic
: Name of the municipality as per the Cadastre.
catr_to
: Cadastral territorial office code.
catr_munic
: Municipality code as recorded on the Cadastre.
catrcode
: Full Cadastral code for the municipality.
cpro
: Province code as per the INE.
catr_munic
: Municipality code as per the INE.
catrcode
: Full INE code for the municipality.
Rest of fields: Check the API Docs.
A tibble
. See Details
mapSpain::esp_get_munic()
to get shapes of municipalities,
including the INE code.
OVCCoordenadas API:
catr_ovc_get_cod_provinces()
Other search:
catr_atom_search_munic()
,
catr_get_code_from_coords()
,
catr_ovc_get_cod_provinces()
# Get municipality by cadastal code ab <- catr_ovc_get_cod_munic(2, 900) ab # Same query using the INE code ab2 <- catr_ovc_get_cod_munic(2, cmun_ine = 3) ab2
# Get municipality by cadastal code ab <- catr_ovc_get_cod_munic(2, 900) ab # Same query using the INE code ab2 <- catr_ovc_get_cod_munic(2, cmun_ine = 3) ab2
Implementation of the OVCCallejero service ConsultaProvincia.
Return a list of the provinces included on the Spanish Cadastre.
catr_ovc_get_cod_provinces(verbose = FALSE)
catr_ovc_get_cod_provinces(verbose = FALSE)
verbose |
Logical, displays information. Useful for debugging,
default is |
A tibble
.
OVCCoordenadas API:
catr_ovc_get_cod_munic()
Other search:
catr_atom_search_munic()
,
catr_get_code_from_coords()
,
catr_ovc_get_cod_munic()
catr_ovc_get_cod_provinces()
catr_ovc_get_cod_provinces()
Implementation of the OVCCoordenadas service Consulta CPMRC.
Return the coordinates for a specific cadastral reference.
catr_ovc_get_cpmrc( rc, srs = 4326, province = NULL, municipality = NULL, verbose = FALSE )
catr_ovc_get_cpmrc( rc, srs = 4326, province = NULL, municipality = NULL, verbose = FALSE )
rc |
The cadastral reference to be geocoded. |
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
province , municipality
|
Optional, used for narrowing the search. |
verbose |
Logical, displays information. Useful for debugging,
default is |
When the API does not provide any result, the function returns a
tibble
with the input parameters only.
On a successful query, the function returns a tibble
with one row by cadastral reference, including the following columns:
xcoord
, ycoord
: X and Y coordinates in the specified SRS.
refcat
: Cadastral Reference.
address
: Address as it is recorded on the Cadastre.
Rest of fields: Check the API Docs.
A tibble
. See Details
catr_srs_values, vignette("ovcservice", package = "CatastRo")
OVCCoordenadas API:
catr_ovc_get_rccoor()
,
catr_ovc_get_rccoor_distancia()
,
catr_srs_values
Other cadastral references:
catr_ovc_get_rccoor()
,
catr_ovc_get_rccoor_distancia()
# using all the arguments catr_ovc_get_cpmrc("13077A01800039", 4230, province = "CIUDAD REAL", municipality = "SANTA CRUZ DE MUDELA" ) # only the cadastral reference catr_ovc_get_cpmrc("9872023VH5797S")
# using all the arguments catr_ovc_get_cpmrc("13077A01800039", 4230, province = "CIUDAD REAL", municipality = "SANTA CRUZ DE MUDELA" ) # only the cadastral reference catr_ovc_get_cpmrc("9872023VH5797S")
Implementation of the OVCCoordenadas service Consulta RCCOOR.
Return the cadastral reference found of a set of specific coordinates.
catr_ovc_get_rccoor(lat, lon, srs = 4326, verbose = FALSE)
catr_ovc_get_rccoor(lat, lon, srs = 4326, verbose = FALSE)
lat |
Latitude to use on the query. It should be specified in the same
in the CRS/SRS |
lon |
Longitude to use on the query. It should be specified in the same
in the CRS/SRS |
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
verbose |
Logical, displays information. Useful for debugging,
default is |
When the API does not provide any result, the function returns a
tibble
with the input parameters only.
On a successful query, the function returns a tibble
with
one row by cadastral reference, including the following columns:
geo.xcen
, geo.ycen
, geo.srs
: Input parameters of the query.
refcat
: Cadastral Reference.
address
: Address as it is recorded on the Cadastre.
Rest of fields: Check the API Docs.
A tibble
. See Details
catr_srs_values, vignette("ovcservice", package = "CatastRo")
OVCCoordenadas API:
catr_ovc_get_cpmrc()
,
catr_ovc_get_rccoor_distancia()
,
catr_srs_values
Other cadastral references:
catr_ovc_get_cpmrc()
,
catr_ovc_get_rccoor_distancia()
catr_ovc_get_rccoor( lat = 38.6196566583596, lon = -3.45624183836806, srs = 4326 )
catr_ovc_get_rccoor( lat = 38.6196566583596, lon = -3.45624183836806, srs = 4326 )
Implementation of the OVCCoordenadas service Consulta RCCOOR Distancia.
Return the cadastral reference found on a set of coordinates. If no cadastral references are found, the API returns a list of the cadastral references found on an area of 50 square meters around the requested coordinates.
catr_ovc_get_rccoor_distancia(lat, lon, srs = 4326, verbose = FALSE)
catr_ovc_get_rccoor_distancia(lat, lon, srs = 4326, verbose = FALSE)
lat |
Latitude to use on the query. It should be specified in the same
in the CRS/SRS |
lon |
Longitude to use on the query. It should be specified in the same
in the CRS/SRS |
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
verbose |
Logical, displays information. Useful for debugging,
default is |
When the API does not provide any result, the function returns a
tibble
with the input parameters only.
On a successful query, the function returns a tibble
with
one row by cadastral reference, including the following columns:
geo.xcen
, geo.ycen
, geo.srs
: Input parameters of the query.
refcat
: Cadastral reference.
address
: Address as it is recorded on the Cadastre.
cmun_ine
: Municipality code as registered on the INE (National
Statistics Institute).
Rest of fields: Check the API Docs.
A tibble
. See Details
catr_srs_values, vignette("ovcservice", package = "CatastRo")
OVCCoordenadas API:
catr_ovc_get_cpmrc()
,
catr_ovc_get_rccoor()
,
catr_srs_values
Other cadastral references:
catr_ovc_get_cpmrc()
,
catr_ovc_get_rccoor()
catr_ovc_get_rccoor_distancia( lat = 40.963200, lon = -5.671420, srs = 4326 )
catr_ovc_get_rccoor_distancia( lat = 40.963200, lon = -5.671420, srs = 4326 )
catr_set_cache_dir()
will store your cache_dir
path on your local machine
and would load it for future sessions.
Alternatively, you can store the cache_dir
manually with the following
options:
Run Sys.setenv(CATASTROESP_CACHE_DIR = "cache_dir")
. You would need to
run this command on each session (Similar to install = FALSE
).
Write this line on your .Renviron file:
CATASTROESP_CACHE_DIR = "value_for_cache_dir"
(same behavior than
install = TRUE
). This would store your cache_dir
permanently.
catr_detect_cache_dir()
detects and returns the path to your current
cache_dir
.
catr_set_cache_dir( cache_dir = NULL, overwrite = FALSE, install = FALSE, verbose = TRUE ) catr_detect_cache_dir(...)
catr_set_cache_dir( cache_dir = NULL, overwrite = FALSE, install = FALSE, verbose = TRUE ) catr_detect_cache_dir(...)
cache_dir |
A path to a cache directory. On |
overwrite |
If this is set to |
install |
if |
verbose |
Logical, displays information. Useful for debugging,
default is |
... |
Ignored |
catr_set_cache_dir()
is called for its side effects, and returns an
(invisible) character with the path to your cache_dir
.
catr_detect_cache_dir()
returns the path to the cache_dir
used in this
session
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
Other cache utilities:
catr_clear_cache()
# Don't run this! It would modify your current state ## Not run: catr_set_cache_dir(verbose = TRUE) ## End(Not run) catr_detect_cache_dir()
# Don't run this! It would modify your current state ## Not run: catr_set_cache_dir(verbose = TRUE) ## End(Not run) catr_detect_cache_dir()
A tibble
including the valid SRS (also known as CRS)
values that may be used on each API service. The values are provided
as EPSG codes.
A tibble
with 16 rows
and columns:
Spatial Reference System (CRS) value, identified by the corresponding EPSG code.
Description of the SRS/EPSG code.
Logical. Is this code valid on OVC services?
Logical. Is this code valid on INSPIRE WFS services?
Table: Content of catr_srs_values
SRS | Description | ovc_service | wfs_service |
3785 |
Web Mercator |
FALSE |
TRUE |
3857 |
Web Mercator |
FALSE |
TRUE |
4230 |
Geográficas en ED 50 |
TRUE |
FALSE |
4258 |
Geográficas en ETRS89 |
TRUE |
TRUE |
4326 |
Geográficas en WGS 80 |
TRUE |
TRUE |
23029 |
UTM huso 29N en ED50 |
TRUE |
FALSE |
23030 |
UTM huso 30N en ED50 |
TRUE |
FALSE |
23031 |
UTM huso 31N en ED50 |
TRUE |
FALSE |
25829 |
UTM huso 29N en ETRS89 |
TRUE |
TRUE |
25830 |
UTM huso 30N en ETRS89 |
TRUE |
TRUE |
25831 |
UTM huso 31N en ETRS89 |
TRUE |
TRUE |
32627 |
UTM huso 27N en WGS 84 |
TRUE |
FALSE |
32628 |
UTM huso 28N en WGS 84 |
TRUE |
FALSE |
32629 |
UTM huso 29N en WGS 84 |
TRUE |
FALSE |
32630 |
UTM huso 30N en WGS 84 |
TRUE |
FALSE |
32631 |
UTM huso 31N en WGS 84 |
TRUE |
FALSE |
Other databases:
catr_atom_get_address_db_all()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels_db_all()
,
catr_atom_search_munic()
Other INSPIRE WFS services:
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
OVCCoordenadas API:
catr_ovc_get_cpmrc()
,
catr_ovc_get_rccoor()
,
catr_ovc_get_rccoor_distancia()
data("catr_srs_values") # OVC valid codes library(dplyr) catr_srs_values %>% filter(ovc_service == TRUE) # WFS valid codes catr_srs_values %>% filter(wfs_service == TRUE) # Use with sf::st_crs() catr_srs_values %>% filter(wfs_service == TRUE & ovc_service == TRUE) %>% print() %>% # First value slice_head(n = 1) %>% pull(SRS) %>% # As crs sf::st_crs(.)
data("catr_srs_values") # OVC valid codes library(dplyr) catr_srs_values %>% filter(ovc_service == TRUE) # WFS valid codes catr_srs_values %>% filter(wfs_service == TRUE) # Use with sf::st_crs() catr_srs_values %>% filter(wfs_service == TRUE & ovc_service == TRUE) %>% print() %>% # First value slice_head(n = 1) %>% pull(SRS) %>% # As crs sf::st_crs(.)
Get the spatial data of addresses The WFS Service allows to perform several types of queries:
By bounding box: Implemented on catr_wfs_get_address_bbox()
.
Extract objects included on the bounding box provided. See Details.
By street code: Implemented on catr_wfs_get_address_codvia()
. Extract
objects of specific addresses.
By cadastral reference: Implemented on catr_wfs_get_address_rc()
. Extract
objects of specific cadastral references
By postal codes: Implemented on catr_wfs_get_address_postalcode()
.
Extract objects of specific cadastral references
catr_wfs_get_address_bbox(x, srs, verbose = FALSE) catr_wfs_get_address_codvia(codvia, del, mun, srs = NULL, verbose = FALSE) catr_wfs_get_address_rc(rc, srs = NULL, verbose = FALSE) catr_wfs_get_address_postalcode(postalcode, srs = NULL, verbose = FALSE)
catr_wfs_get_address_bbox(x, srs, verbose = FALSE) catr_wfs_get_address_codvia(codvia, del, mun, srs = NULL, verbose = FALSE) catr_wfs_get_address_rc(rc, srs = NULL, verbose = FALSE) catr_wfs_get_address_postalcode(postalcode, srs = NULL, verbose = FALSE)
x |
See Details. It could be:
|
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
verbose |
Logical, displays information. Useful for debugging,
default is |
codvia |
Cadastral street code. |
del |
Cadastral office code. |
mun |
Cadastral municipality code. |
rc |
The cadastral reference to be extracted. |
postalcode |
Postal code. |
When x
is a numeric vector, make sure that the srs
matches the
coordinate values. Additionally, when the srs
correspond to a geographic
reference system (4326, 4258), the function queries the bounding box on
EPSG:3857 - Web Mercator, to overcome
a potential bug on the API side.
When x
is a sf
object, the value srs
is ignored. In
this case, the bounding box of the sf
object would be
used for the query (see sf::st_bbox()
). The query is performed using
EPSG:3857 (Web Mercator). The result is provided
always in the SRS of the sf
object provided as input.
A sf
object.
The API service is limited to a bounding box of 4km2 and a maximum of 5.000 elements.
INSPIRE Services for Cadastral Cartography.
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE WFS services:
catr_srs_values
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
Other addresses:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
Other spatial:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
ad <- catr_wfs_get_address_bbox( c( 233673, 4015968, 233761, 4016008 ), srs = 25830 ) library(ggplot2) ggplot(ad) + geom_sf()
ad <- catr_wfs_get_address_bbox( c( 233673, 4015968, 233761, 4016008 ), srs = 25830 ) library(ggplot2) ggplot(ad) + geom_sf()
Get the spatial data of buildings. The WFS Service allows to perform two types of queries:
By bounding box: Implemented on catr_wfs_get_buildings_bbox()
.
Extract objects included on the bounding box provided. See Details.
By cadastral reference: Implemented on catr_wfs_get_buildings_rc()
.
Extract objects of specific cadastral references.
catr_wfs_get_buildings_bbox(x, what = "building", srs, verbose = FALSE) catr_wfs_get_buildings_rc(rc, what = "building", srs = NULL, verbose = FALSE)
catr_wfs_get_buildings_bbox(x, what = "building", srs, verbose = FALSE) catr_wfs_get_buildings_rc(rc, what = "building", srs = NULL, verbose = FALSE)
x |
See Details. It could be:
|
what |
Information to load. It could be:
|
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
verbose |
Logical, displays information. Useful for debugging,
default is |
rc |
The cadastral reference to be extracted. |
When x
is a numeric vector, make sure that the srs
matches the
coordinate values. Additionally, when the srs
correspond to a geographic
reference system (4326, 4258), the function queries the bounding box on
EPSG:3857 - Web Mercator, to overcome
a potential bug on the API side. The result is provided always in the SRS
provided in srs
.
When x
is a sf object, the value srs
is ignored. The query is
performed using EPSG:3857 (Web Mercator) and the
spatial object is projected back to the SRS of the initial object.
A sf
object.
The API service is limited to a bounding box of 4km2 and a maximum of 5.000 elements.
INSPIRE Services for Cadastral Cartography.
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
Other INSPIRE WFS services:
catr_srs_values
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_parcels_bbox()
Other buildings:
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
Other spatial:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_parcels_bbox()
,
catr_wms_get_layer()
# Using bbox building <- catr_wfs_get_buildings_bbox( c( 376550, 4545424, 376600, 4545474 ), srs = 25830 ) library(ggplot2) ggplot(building) + geom_sf() + labs(title = "Search using bbox") # Using rc rc <- catr_wfs_get_buildings_rc("6656601UL7465N") library(ggplot2) ggplot(rc) + geom_sf() + labs(title = "Search using rc")
# Using bbox building <- catr_wfs_get_buildings_bbox( c( 376550, 4545424, 376600, 4545474 ), srs = 25830 ) library(ggplot2) ggplot(building) + geom_sf() + labs(title = "Search using bbox") # Using rc rc <- catr_wfs_get_buildings_rc("6656601UL7465N") library(ggplot2) ggplot(rc) + geom_sf() + labs(title = "Search using rc")
Get the spatial data of cadastral parcels and zones. The WFS Service allows to perform several types of queries:
By bounding box: Implemented on catr_wfs_get_parcels_bbox()
. Extract
objects included on the bounding box provided. See Details.
By zoning: Implemented on catr_wfs_get_parcels_zoning()
. Extract
objects of a specific cadastral zone.
By cadastral parcel: Implemented on catr_wfs_get_parcels_parcel()
.
Extract cadastral parcels of a specific cadastral reference.
Neighbor cadastral parcels: Implemented on
catr_wfs_get_parcels_neigh_parcel()
. Extract neighbor cadastral parcels
of a specific cadastral reference.
Cadastral parcels by zoning: Implemented on
catr_wfs_get_parcels_parcel_zoning()
. Extract cadastral parcels of a
specific cadastral zone.
catr_wfs_get_parcels_bbox(x, what = "parcel", srs, verbose = FALSE) catr_wfs_get_parcels_zoning(cod_zona, srs = NULL, verbose = FALSE) catr_wfs_get_parcels_parcel(rc, srs = NULL, verbose = FALSE) catr_wfs_get_parcels_neigh_parcel(rc, srs = NULL, verbose = FALSE) catr_wfs_get_parcels_parcel_zoning(cod_zona, srs = NULL, verbose = FALSE)
catr_wfs_get_parcels_bbox(x, what = "parcel", srs, verbose = FALSE) catr_wfs_get_parcels_zoning(cod_zona, srs = NULL, verbose = FALSE) catr_wfs_get_parcels_parcel(rc, srs = NULL, verbose = FALSE) catr_wfs_get_parcels_neigh_parcel(rc, srs = NULL, verbose = FALSE) catr_wfs_get_parcels_parcel_zoning(cod_zona, srs = NULL, verbose = FALSE)
x |
See Details. It could be:
|
what |
Information to load. It could be |
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
verbose |
Logical, displays information. Useful for debugging,
default is |
cod_zona |
Cadastral zone code. |
rc |
The cadastral reference to be extracted. |
When x
is a numeric vector, make sure that the srs
matches the
coordinate values. Additionally, when the srs
correspond to a geographic
reference system (4326, 4258), the function queries the bounding box on
EPSG:3857 - Web Mercator, to overcome
a potential bug on the API side. The result is provided always in the SRS
provided in srs
.
When x
is a sf
object, the value srs
is ignored. The
query is performed using EPSG:3857 (Web Mercator)
and the spatial object is projected back to the SRS of the initial object.
A sf
object.
The API service is limited to the following constrains:
"parcel
: Bounding box of 1km2 and a maximum of 500. elements.
"zoning"
: Bounding box of 25km2 and a maximum of 500 elements.
INSPIRE Services for Cadastral Cartography.
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wms_get_layer()
Other INSPIRE WFS services:
catr_srs_values
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
Other parcels:
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
Other spatial:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wms_get_layer()
cp <- catr_wfs_get_parcels_bbox( c( 233673, 4015968, 233761, 4016008 ), srs = 25830 ) library(ggplot2) ggplot(cp) + geom_sf()
cp <- catr_wfs_get_parcels_bbox( c( 233673, 4015968, 233761, 4016008 ), srs = 25830 ) library(ggplot2) ggplot(cp) + geom_sf()
Get geotagged images from the Spanish Cadastre. This function is a wrapper of
mapSpain::esp_getTiles()
.
catr_wms_get_layer( x, srs, what = c("building", "buildingpart", "parcel", "zoning", "address", "admboundary", "admunit"), styles = "default", update_cache = FALSE, cache_dir = NULL, verbose = FALSE, crop = FALSE, options = NULL, ... )
catr_wms_get_layer( x, srs, what = c("building", "buildingpart", "parcel", "zoning", "address", "admboundary", "admunit"), styles = "default", update_cache = FALSE, cache_dir = NULL, verbose = FALSE, crop = FALSE, options = NULL, ... )
x |
See Details. It could be:
|
srs |
SRS/CRS to use on the query. To check the admitted values check
catr_srs_values, specifically the |
what |
Layer to be extracted, see Details. |
styles |
Style of the WMS layer. See Details. |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. On |
verbose |
Logical, displays information. Useful for debugging,
default is |
crop |
|
options |
A named list containing additional options to pass to the query. |
... |
Arguments passed on to
|
When x
is a numeric vector, make sure that the srs
matches the
coordinate values. When x
is a sf
object, the value
srs
is ignored.
The query is performed using EPSG:3857 (Web Mercator)
and the tile is projected back to the SRS of x
. In
case that the tile looks deformed, try either providing x
or specify the
SRS of the requested tile via the srs
parameter, that ideally would need
to match the SRS of x
. See Examples.
A SpatRaster
is returned, with 3 (RGB) or 4 (RGBA) layers,
see terra::RGB()
.
The parameter what
defines the layer to be extracted. The equivalence with
the
API Docs
equivalence is:
"parcel"
: CP.CadastralParcel
"zoning"
: CP.CadastralZoning
"building"
: BU.Building
"buildingpart"
: BU.BuildingPart
"address"
: AD.Address
"admboundary"
: AU.AdministrativeBoundary
"admunit"
: AU.AdministrativeUnit
The WMS service provide different styles on each layer (what
parameter).
Some of the styles available are:
"parcel"
: styles : "BoundariesOnly"
, "ReferencePointOnly"
,
"ELFCadastre"
.
"zoning"
: styles : "BoundariesOnly"
, "ELFCadastre"
.
"building"
, "buildingpart"
: "ELFCadastre"
"address"
: "Number.ELFCadastre"
"admboundary"
, "admunit"
: "ELFCadastre"
Check the API Docs for more information.
INSPIRE Services for Cadastral Cartography.
mapSpain::esp_getTiles()
and terra::RGB()
. For plotting see
terra::plotRGB()
and tidyterra::geom_spatraster_rgb()
.
INSPIRE API functions:
catr_atom_get_address()
,
catr_atom_get_address_db_all()
,
catr_atom_get_buildings()
,
catr_atom_get_buildings_db_all()
,
catr_atom_get_parcels()
,
catr_atom_get_parcels_db_all()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
Other spatial:
catr_atom_get_address()
,
catr_atom_get_buildings()
,
catr_atom_get_parcels()
,
catr_wfs_get_address_bbox()
,
catr_wfs_get_buildings_bbox()
,
catr_wfs_get_parcels_bbox()
# With a bbox pict <- catr_wms_get_layer( c(222500, 4019500, 223700, 4020700), srs = 25830, what = "parcel" ) library(mapSpain) library(ggplot2) library(tidyterra) ggplot() + geom_spatraster_rgb(data = pict) # With a spatial object parcels <- catr_wfs_get_parcels_neigh_parcel("3662303TF3136B", srs = 25830) # Use styles parcels_img <- catr_wms_get_layer(parcels, what = "buildingpart", srs = 25830, # As parcels object bbox_expand = 0.3, styles = "ELFCadastre" ) ggplot() + geom_sf(data = parcels, fill = "blue", alpha = 0.5) + geom_spatraster_rgb(data = parcels_img)
# With a bbox pict <- catr_wms_get_layer( c(222500, 4019500, 223700, 4020700), srs = 25830, what = "parcel" ) library(mapSpain) library(ggplot2) library(tidyterra) ggplot() + geom_spatraster_rgb(data = pict) # With a spatial object parcels <- catr_wfs_get_parcels_neigh_parcel("3662303TF3136B", srs = 25830) # Use styles parcels_img <- catr_wms_get_layer(parcels, what = "buildingpart", srs = 25830, # As parcels object bbox_expand = 0.3, styles = "ELFCadastre" ) ggplot() + geom_sf(data = parcels, fill = "blue", alpha = 0.5) + geom_spatraster_rgb(data = parcels_img)