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.

Revisions

  1. walkerke created this gist Mar 26, 2025.
    17 changes: 17 additions & 0 deletions pmtiles.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    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
    )