Skip to contents

Use Mapbox's Geocoder widget in a Shiny application

Usage

mapboxGeocoderInput(
  inputId,
  access_token = NULL,
  placeholder = "Search",
  search_within = NULL,
  proximity = NULL,
  limit = 5,
  min_length = 2,
  language = NULL
)

Arguments

inputId

The Shiny input ID

access_token

The Mapbox access token (required); can be set with mb_access_token()

placeholder

The placeholder to be used in the search box; defaults to 'Search'

search_within

An sf object, or vector representing a bounding box of format c(min_longitude, min_latitude, max_longitude, max_latitude) used to limit search results. Defaults to NULL.

proximity

A length-2 vector of longitude and latitude coordinates used to prioritize results near to that location. Defaults to NULL.

limit

The maximum number of results to show. Defaults to 5.

min_length

The minimum number of characters the user must enter before results are shown. Defaults to 2.

language

The language to use for the geocoder. Per the Mapbox documentation, "Options are IETF language tags comprised of a mandatory ISO 639-1 language code and optionally one or more IETF subtags for country or script."

Value

A Mapbox geocoder widget as a Shiny input