This function connects to Czech State Administration of Land Surveying and Cadastre (https://www.cuzk.cz/en) API to geocode an address. As consequence it is implemented only for Czech addresses.
Value
sf
data frame with 3 variables + geometry
- address
the address searched (address input)
- type
type of record matched by API
- result
address as returned by API / recorded in RÚIAN
- geometry
hidden column with spatial point data
Details
Input of the function are an address to geocode (or a vector of addresses) and expected Coordinate Reference System of output (default is WGS84 = EPSG:4326, but in some use cases inž. Křovák = EPSG:5514 may be more relevant).
NA's in input are considered an error.
Output is a sf
data frame of spatial points.
Depending on the outcome of matching the address to RÚIAN data there is a number of possible outcomes:
All items were matched exactly: the returned
sf
data frame has the same number of rows as there were elements in vector to be geocoded. The field target will have zero duplicates.Some items had multiple matches: the returned
sf
data frame has more rows than the there were elements in vector to be geocoded. In the field target will be duplicate values. Note that the RÚIAN API limits multiple matches to 10.Some (but not all) items had no match in RUIAN data: the returned
sf
data frame will have fewer rows than the vector sent. to be geocoded elements. Some values will be missing from field target.No items were matched at all: the function returns empty data frame and a message.
The CUZK API is down or overloaded: the function returns empty data frame and a message.
Note that character encoding is heavily platform dependent, and you may need to convert to UTF-8,
e.g. by running address <- iconv(address, from = "windows-1250", to = "UTF-8")
before calling the function.
Usage of the ČÚZK API is governed by ČÚZK Terms & Conditions - https://geoportal.cuzk.cz/Dokumenty/Podminky.pdf.
Examples
# \donttest{
asdf <- geocode("Gogolova 212, Praha 1")
print(asdf)
#> Simple feature collection with 1 feature and 3 fields
#> Attribute-geometry relationships: constant (3)
#> Geometry type: POINT
#> Dimension: XY
#> Bounding box: xmin: 14.41042 ymin: 50.09346 xmax: 14.41042 ymax: 50.09346
#> Geodetic CRS: WGS 84
#> address type result
#> 1 Gogolova 212, Praha 1 AdresniMisto Gogolova 212/1, Hradčany, 11800 Praha 1
#> geometry
#> 1 POINT (14.41042 50.09346)
# }