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

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

Arguments

address

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

alternatives

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

sf

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

url_only

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

Value

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."

Examples

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

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