cartociudad_geocode: Interface to Cartociudad geolocation API

View source: R/cartociudad_geocode.R

cartociudad_geocodeR Documentation

Interface to Cartociudad geolocation API

Description

Geolocation of Spanish addresses via Cartociudad API calls, providing the full address in a single text string via full_address. It is advisable to add the street type (calle, etc.) and to omit the country name.

Usage

cartociudad_geocode(full_address, on.error = "fail", ...)

Arguments

full_address

Character string providing the full address to be geolocated; e.g., "calle miguel servet 5, zaragoza". Adding the country may cause problems.

on.error

Defaults to fail; in such case, in case of errors in the API call, the process will fail. Set it to "warn" and, in case of errors, the function will return NULL and a warning.

...

Other parameters for the API. See Details section below.

Details

The entity geolocation API admits more parameters beyond the address field such as id or type. You can use these extra arguments (see the References or the Examples sections below for further information) at your own risk.

Value

A data frame consisting of a single row per guess. See the reference below for an explanation of the data frame columns.

Author(s)

Carlos J. Gil Bellosta

References

http://www.cartociudad.es/recursos/Documentacion_tecnica/CARTOCIUDAD_ServiciosWeb.pdf

Examples

# standard usage
res <- cartociudad_geocode(full_address = "plaza de cascorro 11, 28005 madrid")

#' # km 41 of A-23 motorway
res <- cartociudad_geocode("A-23 41")

# specific usage (see References for details)
res <- cartociudad_geocode("A-23 41", type = "portal", id = "600000000045", portal = 41)

# vectorized call
## Not run: 
addresses <- paste("A-23", 1:10)
res <- lapply(addresses, cartociudad_geocode, on.error = "warn")

## End(Not run)

rOpenSpain/caRtociudad documentation built on June 9, 2022, 7:38 p.m.