Skip to content

Instantly share code, notes, and snippets.

@walkerke
Created March 26, 2025 22:25
Show Gist options
  • Save walkerke/cf87df489be8065635cf9b0c0dee34f5 to your computer and use it in GitHub Desktop.
Save walkerke/cf87df489be8065635cf9b0c0dee34f5 to your computer and use it in GitHub Desktop.
library(mapgl)
pmtiles <- "https://r2-public.protomaps.com/protomaps-sample-datasets/cb_2018_us_zcta510_500k.pmtiles"
maplibre(center = c(-97, 35), zoom= 3) |>
set_projection("globe") |>
add_vector_source("pmtiles_source",
url = paste0("pmtiles://", pmtiles)
) |>
add_fill_layer(
id = "pmtiles_layer",
source = "pmtiles_source",
source_layer = "zcta",
tooltip = "GEOID10",
fill_color = "blue",
fill_opacity = 0.7
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment