search: Mapzen search API

mz_autocompleteR Documentation

Mapzen search API

Description

Functions to access the various endpoints from the Mapzen Search API. For more details, see https://github.com/pelias/documentation/. If your data is already split up by street, city, state, zip, etc., then you might find mz_structured_search to be more precise. All arguments besides text (point in the case of mz_reverse_geocode) are optional. If you have parsed addresses (e.g. for geocoding), use mz_structured_search

Usage

mz_autocomplete(
  text,
  boundary.country = NULL,
  boundary.rect = NULL,
  focus.point = NULL,
  sources = NULL,
  layers = NULL,
  api_key = NULL
)

mz_reverse_geocode(
  point,
  size = NULL,
  layers = NULL,
  sources = NULL,
  boundary.country = NULL,
  api_key = NULL
)

mz_search(
  text,
  size = 10,
  boundary.country = NULL,
  boundary.rect = NULL,
  boundary.circle = NULL,
  focus.point = NULL,
  sources = NULL,
  layers = NULL,
  api_key = NULL
)

Arguments

text

Search string

boundary.country

ISO-3166 country code to narrow the search. See mz_countries

boundary.rect

4 corners that define a box to narrow the search. Can be the result of mz_bbox. Should have named elements with names "min_lon", "min_lat", "max_lon", "max_lat" – can be created using mz_rect.

focus.point

A point to "focus" the search. Can be created with mz_location or mz_geocode, otherwise should have names "lat" and "lon"

sources

The originating source of the data (to filter/narrow search results). See mz_sources

layers

Which layers (types of places) to search. See https://github.com/pelias/documentation/ for definitions, and use mz_layers for convenience

api_key

Your Mapzen API key. The default is to look for the key within the provider information that was set up with 'mz_set_host'.

point

For reverse geocoding, the location to reverse geocode. Can be created with mz_location or mz_geocode, otherwise should have names "lat" and "lon"

size

Number of search results requested

boundary.circle

A circle to narrow the search. Should have named elements with names "lon", "lat", and "radius"

See Also

mz_place, mz_structured_search, mz_countries, mz_sources, mz_layers

Examples

## Not run: 
# hard rock cafes in sweden:
mz_search("Hard Rock Cafe", boundary.country = "SE")

# autocompletions when the user types in "Union Square"
# prioritizing San Francisco results first:
mz_autocomplete("Union Square",
                focus.point = mz_geocode("San Francisco, CA"))

## End(Not run)


tarakc02/rmapzen documentation built on Oct. 19, 2023, 7:32 p.m.