add_pmtiles_source | R Documentation |
Add a PMTiles source to a Mapbox GL or Maplibre GL map
add_pmtiles_source(map, id, url, ...)
map |
A map object created by the |
id |
A unique ID for the source. |
url |
A URL pointing to the PMTiles archive. |
... |
Additional arguments to be passed to the JavaScript addSource method. |
The modified map object with the new source added.
## Not run:
# Visualize the Overture Maps places data as PMTiles
# Works with either `maplibre()` or `mapboxgl()`
library(mapgl)
maplibre(style = maptiler_style("basic", variant = "dark")) |>
set_projection("globe") |>
add_pmtiles_source(
id = "places-source",
url = "https://overturemaps-tiles-us-west-2-beta.s3.amazonaws.com/2025-06-25/places.pmtiles"
) |>
add_circle_layer(
id = "places-layer",
source = "places-source",
source_layer = "place",
circle_color = "cyan",
circle_opacity = 0.7,
circle_radius = 4,
tooltip = concat(
"Name: ",
get_column("@name"),
"<br>Confidence: ",
number_format(get_column("confidence"), maximum_fraction_digits = 2)
)
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.