Query the OVCCallejero ConsultaMunicipioCodigos service to retrieve municipality names and codes from the Spanish Cadastre and the National Statistics Institute (INE).
Arguments
- cpro
Province code returned by
catr_ovc_get_cod_provinces().- cmun, cmun_ine
Municipality code as recorded by the Spanish Cadastre (
cmun) or the National Statistics Institute. Eithercmunorcmun_inemust be provided.- verbose
Logical. If
TRUE, displays informational messages.
Value
A tibble as described in Details. Returns
NULL if the request fails.
Details
On a successful query, this function returns a tibble with one row including the following columns:
munic: Municipality name used by the Spanish Cadastre.catr_to: Cadastral territorial office code.catr_munic: Municipality code as recorded by the Cadastre.catrcode: Full cadastral code for the municipality.cpro: Province code according to the INE.cmun: Municipality code according to the INE.inecode: Full INE code for the municipality.Remaining fields: See the API documentation.
See also
mapSpain::esp_get_munic_siane() to get shapes of municipalities, including
the INE code.
Query OVC province and municipality codes:
catr_ovc_get_cod_provinces()
Search for cadastral identifiers:
catr_atom_search_munic(),
catr_get_code_from_coords(),
catr_ovc_get_cod_provinces()
Examples
# \donttest{
# Get municipality by cadastral code
ab <- catr_ovc_get_cod_munic(cpro = 2, cmun = 900)
ab
#> # A tibble: 1 × 12
#> munic catr_to catr_munic catrcode cpro cmun inecode nm cd cmc cp
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 ALBAC… 02 900 02900 02 003 02003 ALBA… 2 900 2
#> # ℹ 1 more variable: cm <chr>
# Same query using the INE code
ab2 <- catr_ovc_get_cod_munic(cpro = 2, cmun_ine = 3)
ab2
#> # A tibble: 1 × 12
#> munic catr_to catr_munic catrcode cpro cmun inecode nm cd cmc cp
#> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 ALBAC… 02 900 02900 02 003 02003 ALBA… 2 900 2
#> # ℹ 1 more variable: cm <chr>
# }
