revgeo: Reversely Geocode a Czech Address

Description Usage Arguments Details Examples

View source: R/revgeo.R

Description

This function connects to Czech State Administration of Land Surveying and Cadastre (https://www.cuzk.cz/en) API to reversely geocode an address. As consequence it is implemented only for Czech addresses.

Usage

1
revgeo(coords)

Arguments

coords

coordinates to be reverse geocoded; expected as sf data frame of spatial points

Details

Input of the function is a sf data frame of spatial points, and output a vector of characters.

The function returns the same sf data frame as input, with added field revgeocoded; it contains the result of operation. Should the data frame contain a column named revgeocoded it will be overwritten.

In case of reverse geocoding failures (e.g. coordinates outside of the Czech Republic and therefore scope of ČÚZK) NA is returned.

In case of API failures (CUZK down) the function returns NAs again, with a message.

Usage of the ČÚZK API is governed by ČÚZK Terms & Conditions - https://geoportal.cuzk.cz/Dokumenty/Podminky.pdf.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
library(dplyr)
library(sf)

brno <- obce_polygony() %>% # shapefile of Brno
  filter(NAZ_OBEC == "Brno") %>%
  st_transform(5514) # planar CRS (eastings & northings)

pupek_brna <- st_centroid(brno) # calculate centroid

adresa_pupku <- revgeo(pupek_brna)$revgeocoded # address of the center

RCzechia documentation built on April 12, 2021, 1:07 a.m.