Geocodes addresses using the HERE 'Geocoding & Search API' API.

geocode(address, alternatives = FALSE, sf = TRUE, url_only = FALSE)



character, addresses to geocode or a list containing qualified queries with the keys "country", "state", "county", "city", "district", "street", "houseNumber" or "postalCode".


boolean, return also alternative results (default = FALSE)?


boolean, return an sf object (default = TRUE) or a data.frame?


boolean, only return the generated URLs (default = FALSE)?


If sf = TRUE, an sf object, containing the position coordinates geocoded addresses as geometry list column and the access coordinates as well-known text (WKT). If sf = FALSE, a data.frame containing the coordinates of the geocoded addresses as lng, lat columns. According to the Geocoding and Search API Reference, the access coordinates are "[c]oordinates of the place you are navigating to (for example, driving or walking). This is a point on a road or in a parking lot." The position coordinates are "[t]he coordinates (latitude, longitude) of a pin on a map corresponding to the searched place."


# Provide an API Key for a HERE project
set_key("<YOUR API KEY>")

locs <- geocode(address = poi$city, url_only = TRUE)