get_vector_tiles: Retrieve vector tiles from a given Mapbox tileset

View source: R/maps.R

get_vector_tilesR Documentation

Retrieve vector tiles from a given Mapbox tileset

Description

Retrieve vector tiles from a given Mapbox tileset

Usage

get_vector_tiles(tileset_id, location, zoom, access_token = NULL)

Arguments

tileset_id

The name of the tileset ID; names can be retrieved from your Mapbox account

location

The location for which you'd like to retrieve tiles. If the input is an sf object, the function will return data for all tiles that intersect the object's bounding box. If the input is a coordinate pair or an address, data will be returned for the specific tile that contains the input.

zoom

The zoom level of the request; larger zoom levels will return more detail but will take longer to process.

access_token

A Mapbox access token; which can be set with mb_access_token().

Value

A list of sf objects representing the different layer types found in the requested vector tiles.

Examples

## Not run: 

library(mapboxapi)
library(ggplot2)

vector_extract <- get_vector_tiles(
  tileset_id = "mapbox.mapbox-streets-v8",
  location = c(-73.99405, 40.72033),
  zoom = 15
)

ggplot(vector_extract$building$polygons) +
  geom_sf() +
  theme_void()

## End(Not run)


mapboxapi documentation built on Sept. 21, 2024, 1:06 a.m.