View source: R/catr-code-coords.R
| catr_get_code_from_coords | R Documentation |
Retrieve the municipality code associated with an sf object
or a coordinate pair.
catr_get_code_from_coords(
x,
srs = NULL,
verbose = FALSE,
cache_dir = NULL,
...
)
x |
Coordinate input. It can be:
|
srs |
SRS/CRS to use in the query. To see allowed values, use
catr_srs_values, specifically the |
verbose |
Logical. Whether to display informational messages. |
cache_dir |
Path to a cache directory. If |
... |
Arguments passed on to
|
On a successful query, this function returns a one-row tibble with 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.
A tibble as described in Details. Returns
NULL if the request fails.
mapSpain::esp_get_munic_siane() retrieves municipality geometries.
catr_ovc_get_cod_munic() retrieves municipality codes.
sf::st_centroid() computes geometry centroids.
Search for cadastral identifiers:
catr_atom_search_munic(),
catr_ovc_get_cod_munic(),
catr_ovc_get_cod_provinces()
# Use with coordinates
catr_get_code_from_coords(c(-16.25462, 28.46824), srs = 4326)
# Use with an `sf` object.
prov <- mapSpain::esp_get_prov("Caceres")
catr_get_code_from_coords(prov)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.