/r-package-skills:r-freestilerfrom r-package-skills
Converts spatial data into PMTiles vector tilesets using freestiler in R. Handles large datasets (>10k features) for mapgl/MapLibre visualization.
Ships in r-package-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
freestiler converts spatial data into PMTiles vector tilesets. Rust-powered tool for creating .pmtiles from sf objects, files, or DuckDB SQL.
Read references/API.md before writing code.
references/API.md - Complete function reference with all parametersreferences/getting-started.md - Usage patterns and parameter examplesreferences/zoom-strategy.md - Zoom level guidance by geometry typereferences/workflows.md - Complete workflows and integration patternsreferences/mapping.md - Visualization and server configurationUse when:
Don't use:
maplibre_view()| Function | Use Case | Key Params |
|---|---|---|
freestile() | Tile sf objects | input, output, layer_name, min_zoom, max_zoom, base_zoom (opt), drop_rate (opt), tile_format (opt) |
freestile_query() | Tile from SQL (streaming) | query, output, layer_name, min_zoom, max_zoom, streaming = "always" |
freestile_file() | Tile without loading | input, output, layer_name, min_zoom, max_zoom, engine |
view_tiles() | Quick visualization | input, layer_type, color |
serve_tiles() | Start local server | path, port |
library(freestiler)
library(sf)
# Basic workflow - counties use max_zoom = 10
nc <- st_read(system.file("shape/nc.shp", package = "sf"))
freestile(input = nc, output = "nc.pmtiles", layer_name = "counties", max_zoom = 10)
view_tiles("nc.pmtiles") # Auto-starts server + opens map
# Large datasets: streaming
freestile_query(query = "SELECT * FROM read_parquet('huge.parquet')",
output = "points.pmtiles", layer_name = "locations",
streaming = "always") # Critical for 10M+ points
# Direct file (no loading to memory)
freestile_file(input = "data.gpkg", output = "output.pmtiles",
layer_name = "features")
view_tiles() (Easiest): view_tiles("nc.pmtiles")
Manual Server + mapgl:
serve_tiles("tiles/")
maplibre() |>
add_pmtiles_source(id = "src", url = "http://localhost:8080/data.pmtiles") |>
add_fill_layer(source = "src", source_layer = "layer1")
Direct file://: Requires absolute path in add_pmtiles_source(url = "file://W:/...")
input, output, layer_name (NOT data, tileset, layer)layer_name in freestile() must match source_layer in mapglst_transform(4326) before tilingfreestile_file() or freestile_query() to avoid loading into memorystreaming = "always" to freestile_query()serve_tiles() struggles with byte-range requests; launch npx http-server from R via processx::process$new() instead. See references/mapping.md "Serving Large Tilesets" for a ready-made helper function.maplibre_view() from mapglSee references/ for:
Test with validator: Use lib/r-validators/plot-validator.R to verify map output in tests
references/API.md (opens in a new tab)references/getting-started.md (opens in a new tab)references/mapping.md (opens in a new tab)references/performance.md (opens in a new tab)references/sql-patterns.md (opens in a new tab)references/workflows.md (opens in a new tab)references/zoom-strategy.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
vector-tiles, pmtiles, spatial-data, r-package, map-visualization
14 skills in this plugin
/r-aiUse when code loads ellmer, btw, mcptools, ragnar, or vitals, building LLM-powered R applications, implementing RAG workflows, or choosing between R AI packages (meta-skill for ellmer/btw/mcptools/ragnar/vitals)/r-btwUse when code loads or uses btw (library(btw), btw::), providing R session context to LLMs, registering tools for ellmer chat, or copying R object descriptions to clipboard/r-collapseUse when code loads or uses collapse (library(collapse), collapse::), performing fast grouped or weighted statistics in R, or seeking faster alternatives to dplyr aggregationnpx claudepluginhub arthurgailes/r-package-skills --plugin r-package-skillsOther plugins' skills for the same job