OVCCoordenadas web service

Ángel Delgado Panadero

Diego Hernangómez

CatastRo provides an R interface to the OVCCoordenadas web service from the Sede electrónica del Catastro.

This service retrieves the spatial coordinates of an urban property. You do not need to be the owner to get the information. You only need to know the cadastral reference of the property. Although the cadastral reference is the only required argument, providing the address can improve results and help avoid errors.

The service can also obtain the cadastral reference of an urban property from longitude and latitude. It allows you to choose the spatial reference system (SRS, also known as CRS) used to express the coordinates.

The service also handles cases where the exact location of the registered urban property is unknown. In such cases, it returns all properties located within a 50-meter square around the given point.

The documentation for this service is available here.

These functions use the catr_ovc_get_*() prefix and return tibbles from the tibble package.

CatastRo API

The OVCCoordenadas web service can be accessed using the following functions:

Reverse geocoding cadastral references

catr_ovc_get_rccoor() takes the coordinates (lat and lon) and the spatial reference system (srs) used to express them. It returns a tibble with the cadastral reference of the property at that spatial point, including other information such as the address (town, street and number).

library(CatastRo)

result <- catr_ovc_get_rccoor(
  lat = 38.6196566583596,
  lon = -3.45624183836806,
  srs = "4230"
)

knitr::kable(result)
refcat address pc.pc1 pc.pc2 geo.xcen geo.ycen geo.srs ldt
13077A01800039 DS DISEMINADO Polígono 18 Parcela 39 000100200VH67C EL TIRADERO. SANTA CRUZ DE MUDELA (CIUDAD REAL) 13077A0 1800039 -3.456242 38.61966 EPSG:4230 DS DISEMINADO Polígono 18 Parcela 39 000100200VH67C EL TIRADERO. SANTA CRUZ DE MUDELA (CIUDAD REAL)

This function accepts the following values for the srs argument:

data(catr_srs_values)

# OVC valid codes.
library(dplyr)

catr_srs_values |>
  filter(ovc_service == TRUE) |>
  select(SRS, Description) |>
  knitr::kable()
SRS Description
4230 Geográficas en ED 50
4258 Geográficas en ETRS89
4326 Geográficas en WGS 80
23029 UTM huso 29N en ED50
23030 UTM huso 30N en ED50
23031 UTM huso 31N en ED50
25829 UTM huso 29N en ETRS89
25830 UTM huso 30N en ETRS89
25831 UTM huso 31N en ETRS89
32627 UTM huso 27N en WGS 84
32628 UTM huso 28N en WGS 84
32629 UTM huso 29N en WGS 84
32630 UTM huso 30N en WGS 84
32631 UTM huso 31N en WGS 84

It is also possible to get all cadastral references within a 50-meter square centered on the coordinates lat and lon using the function catr_ovc_get_rccoor_distancia().

catr_ovc_get_rccoor_distancia(
  lat = 40.96002,
  lon = -5.663408,
  srs = "4230"
) |>
  knitr::kable()
geo.xcen geo.ycen geo.srs refcat address cmun_ine pc.pc1 pc.pc2 dt.loine.cp dt.loine.cm dt.lourb.dir.cv dt.lourb.dir.pnp ldt dis
-5.663408 40.96002 EPSG:4230 5877501TL7357F AV REYES DE ESPAÑA 1 SALAMANCA (SALAMANCA) 37274 5877501 TL7357F 37 274 643 1 AV REYES DE ESPAÑA 1 SALAMANCA (SALAMANCA) 21.81
-5.663408 40.96002 EPSG:4230 5778706TL7357H AV REYES DE ESPAÑA 2 N2-4 SALAMANCA (SALAMANCA) 37274 5778706 TL7357H 37 274 643 2 AV REYES DE ESPAÑA 2 N2-4 SALAMANCA (SALAMANCA) 23.18

Geocoding a cadastral reference

The opposite query is also possible. When provided with a cadastral reference (rc), province (province) and municipality (municipality), the function catr_ovc_get_cpmrc() returns the coordinates (lat and lon) in a specified srs, along with the address (town, street and number).

catr_ovc_get_cpmrc(
  rc = "13077A01800039",
  srs = "4230",
  province = "CIUDAD REAL",
  municipality = "SANTA CRUZ DE MUDELA"
) |>
  knitr::kable()
xcoord ycoord refcat address pc.pc1 pc.pc2 geo.xcen geo.ycen geo.srs ldt
-3.456242 38.61966 13077A01800039 DS DISEMINADO Polígono 18 Parcela 39 000100200VH67C EL TIRADERO. SANTA CRUZ DE MUDELA (CIUDAD REAL) 13077A0 1800039 -3.45624183836806 38.6196566583596 EPSG:4230 DS DISEMINADO Polígono 18 Parcela 39 000100200VH67C EL TIRADERO. SANTA CRUZ DE MUDELA (CIUDAD REAL)

The province and municipality arguments are optional, but if municipality is provided, province must also be provided. If a value is passed to the province argument while municipality is NULL, the function catr_ovc_get_cpmrc() displays a message and returns an empty tibble.

catr_ovc_get_cpmrc(
  rc = "13077A01800039",
  municipality = "SANTA CRUZ DE MUDELA"
) |>
  knitr::kable()
#> ✖ OVC service error 11: LA PROVINCIA ES OBLIGATORIA
refcat geo.srs
13077A01800039 EPSG:4326

When using only rc, the result is provided as expected:

# Get the result without a warning.
catr_ovc_get_cpmrc(rc = "13077A01800039") |>
  knitr::kable()
xcoord ycoord refcat address pc.pc1 pc.pc2 geo.xcen geo.ycen geo.srs ldt
-3.457532 38.61843 13077A01800039 DS DISEMINADO Polígono 18 Parcela 39 000100200VH67C EL TIRADERO. SANTA CRUZ DE MUDELA (CIUDAD REAL) 13077A0 1800039 -3.45753233627867 38.6184314024661 EPSG:4326 DS DISEMINADO Polígono 18 Parcela 39 000100200VH67C EL TIRADERO. SANTA CRUZ DE MUDELA (CIUDAD REAL)