geo_amenity: Geocode amenities

View source: R/geo_amenity.R

geo_amenityR Documentation

Geocode amenities

Description

This function search amenities as defined by OpenStreetMap on a restricted area defined by a bounding box in the form of ⁠(<min_latitude>, <min_longitude>, <max_latitude>, <max_longitude>)⁠. This function returns the tibble associated with the query, see geo_amenity_sf() for retrieving the data as a spatial object (sf format).

Usage

geo_amenity(
  bbox,
  amenity,
  lat = "lat",
  long = "lon",
  limit = 1,
  full_results = FALSE,
  return_addresses = TRUE,
  verbose = FALSE,
  custom_query = list(),
  strict = FALSE
)

Arguments

bbox

A numeric vector of latitude and longitude ⁠(<min_latitude>, <min_longitude>, <max_latitude>, <max_longitude>)⁠ that restrict the search area. See Details.

amenity

A character of a vector of character with the amenities to be geolocated (i.e. c("pub", "restaurant")). See Details and osm_amenities.

lat

latitude column name in the output data (default "lat").

long

longitude column name in the output data (default "long").

limit

maximum number of results to return per input address. Note that each query returns a maximum of 50 results.

full_results

returns all available data from the API service. If FALSE (default) only latitude, longitude and address columns are returned. See also return_addresses.

return_addresses

return input addresses with results if TRUE.

verbose

if TRUE then detailed logs are output to the console.

custom_query

API-specific parameters to be used. See geo_lite().

strict

Logical TRUE/FALSE. Force the results to be included inside the bbox. Note that Nominatim default behavior may return results located outside the provided bounding box.

Details

Bounding boxes can be located using different online tools, as Bounding Box Tool.

For a full list of valid amenities see https://wiki.openstreetmap.org/wiki/Key:amenity.

Value

A tibble with the results.

See Also

geo_amenity_sf()

Search amenities: bbox_to_poly(), geo_amenity_sf(), osm_amenities

Geocoding strings: geo_address_lookup_sf(), geo_address_lookup(), geo_amenity_sf(), geo_lite_sf(), geo_lite()

Examples



# Times Square, NY, USA
bbox <- c(-73.9894467311, 40.75573629, -73.9830630737, 40.75789245)

geo_amenity(bbox = bbox, amenity = "restaurant")

# Several amenities
geo_amenity(bbox = bbox, amenity = c("restaurant", "pub"))

# Increase limit and use with strict
geo_amenity(
  bbox = bbox, amenity = c("restaurant", "pub"), limit = 10,
  strict = TRUE
)



nominatimlite documentation built on Aug. 15, 2023, 5:08 p.m.