Search for places within an extent (bounding box).

The /places/within-extent request searches for places within an extent (bounding box).

Usage

within_extent(
  xmin,
  ymin,
  xmax,
  ymax,
  search_text = NULL,
  category_id = NULL,
  icon = NULL,
  token = arc_token()
)

Arguments

xmin

The minimum x coordinate, or longitude, of the search extent in EPSG:4326.

ymin

The minimum y coordinate, or latitude, of the search extent in EPSG:4326

xmax

The maximum x coordinate, or longitude, of the search extent in EPSG:4326.

ymax

The maximum y coordinate, or latitude, of the search extent in EPSG:4326

search_text

Default NULL. Free search text for places against names, categories etc. Must be a scalar value.

category_id

Default NULL. A character vector which filters places to those that match the category IDs.

icon

Default NULL. Must be one of "svg", "png" "cim". Determines whether icons are returned and the type of icon to use with a place or category.

token

an object of class httr2_token as generated by auth_code() or related function

Value

An sf object with columns

  • place_id: The unique Id of this place. The ID can be passed to place_details() to retrieve additional details.

  • name: The name of the place, or point of interest. You can search for places by name using the searchText property

  • categories: A data.frame with two columns category_id and label. Categories are uniquely identified by a categoryId. For example, 17119 identifies a "Bicycle Store" and 10051 identifies a "Stadium". Note that a single place can belong to multiple categories (for example, a petrol station could also have a super-market).

  • icon: A character vector of the URL for an icon for this place or category in either svg, cim or png format.

  • geometry: an sfc_POINT object in EPSG:4326

Details

You must supply the xmin, ymin, xmax and ymax coordinates to define the extent. The maximum width and height of an extent that can be used in a search is 20,000 meters.

You can also provide multiple categories or search text to find specific types of places within the extent.

Note: You cannot permanently store places. Please see the Terms of use.

Note: Query parameters are case-sensitive.

References

API Documentation

Examples

if (FALSE) {
within_extent(
  139.74,
  35.65,
  139.75,
  35.66,
  category_ids = "10001"
)
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.