tippecanoe | R Documentation |
Tippecanoe is a tile-generation utility for building vector tilesets from large (or small) collections of GeoJSON, Geobuf, or CSV features. The tippecanoe function requires that the tippecanoe utility is installed on your system; see the tippecanoe documentation for installation instructions. Once installed, tippecanoe can be used in large visualization workflows in concert with Mapbox Studio.
tippecanoe(
input,
output,
layer_name = NULL,
min_zoom = NULL,
max_zoom = NULL,
drop_rate = NULL,
overwrite = TRUE,
other_options = NULL,
keep_geojson = FALSE
)
input |
The dataset from which to generate vector tiles. Can be an sf object or GeoJSON file on disk. |
output |
The name of the output .mbtiles file (with .mbtiles extension). Will be saved in the current working directory. |
layer_name |
The name of the layer in the output .mbtiles file. If NULL,
will either be a random string (if input is an |
min_zoom , max_zoom |
The minimum and maximum zoom levels for which to compute tiles. If both min_zoom and max_zoom are blank, tippecanoe will guess the best zoom levels for your data. |
drop_rate |
The rate at which tippecanoe will drop features as you zoom out. If NULL, tippecanoe will drop features as needed in the densest tiles to stay within Mapbox's limits. |
overwrite |
If |
other_options |
A character string of other options to be passed to the tippecanoe program. |
keep_geojson |
Whether nor not to keep the temporary CSV or GeoJSON file
used to generate the tiles. Defaults to |
Mapbox also offers the Mapbox Tiling Service as an alternate way to transform datasets into vector tiles.
## Not run:
# Workflow: create a dynamic tileset for dot-density mapping
library(tidycensus)
library(sf)
library(mapboxapi)
# Get population data for Census tracts in Vermont
vt_population <- get_decennial(
geography = "tract",
variables = "P001001",
state = "Vermont",
year = 2010,
geometry = TRUE
)
# Convert to representative dots - 1 per person
vt_dots <- st_sample(
vt_population,
size = vt_population$value
)
# Use tippecanoe to create dynamic tiles
tippecanoe(
input = vt_dots,
output = "vt_population.mbtiles",
layer_name = "vermont_population",
max_zoom = 18,
drop_rate = 1.5
)
# Upload to your Mapbox account for visualization
# A Mapbox secret access token must be set with mb_access_token()
# to upload data to your account
upload_tiles(
input = "vt_population.mbtiles",
username = "kwalkertcu",
tileset_id = "vt_population_dots",
multipart = TRUE
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.