Learn R Programming

mapboxapi (version 0.6.2)

upload_tiles: Upload dataset to your Mapbox account

Description

Upload dataset to your Mapbox account

Usage

upload_tiles(
  input,
  username,
  access_token = NULL,
  tileset_id = NULL,
  tileset_name = NULL,
  keep_geojson = FALSE,
  multipart = FALSE
)

Arguments

input

An sf object, or the path to the dataset to upload as a character string.

username

Your Mapbox username

access_token

Your Mapbox access token; must have secret scope

tileset_id

The ID of the tileset in your Mapbox account

tileset_name

The name of the tileset in your Mapbox account

keep_geojson

Whether or not to keep the temporary GeoJSON used to generate the tiles (if the input is an sf object)

multipart

Whether or not to upload to the temporary AWS staging bucket as a multipart object; defaults to FALSE.

Examples

Run this code
if (FALSE) {

# Example: create a tileset of median age for all United States Census tracts
# Requires setting a Mapbox secret access token as an environment variable

library(mapboxapi)
library(tidycensus)
options(tigris_use_cache = TRUE)

median_age <- get_acs(
  geography = "tract",
  variables = "B01002_001",
  state = c(state.abb, "DC"),
  geometry = TRUE
)

upload_tiles(
  input = median_age,
  username = "kwalkertcu", # Your username goes here
  tileset_id = "median_age",
  tileset_name = "us_median_age_2014_to_2018"
)
}

Run the code above in your browser using DataLab