Get addresses from locations using the HERE 'Geocoder' API. The return value is an sf object, containing point geometries with suggestions for addresses near the provided POIs.

reverse_geocode(poi, results = 1, sf = TRUE, url_only = FALSE)

Arguments

poi

sf object, Points of Interest (POIs) of geometry type POINT.

results

numeric, maximum number of results (Valid range: 1 and 100).

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 of the reverse geocoded POIs as geometry list column and the access coordinates as well-known text (WKT). If sf = FALSE, a data.frame containing the coordinates of the reverse geocoded POIs as lng, lat columns.

Note

If no addresses are found near a POI, NULL for this POI is returned. In this case the rows corresponding to this particular POI are missing and merging the POIs by row is not possible. However, in the returned sf object, the column "id" matches the rows of the input POIs. The "id" column can be used to join the original POIs.

Examples

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

# Get addresses
addresses <- reverse_geocode(poi = poi, results = 3, url_only = TRUE)