From r-package-skills
Use when code loads or uses freestiler, working with .pmtiles files, creating or serving PMTiles vector tilesets in R, or preparing spatial data for mapgl/MapLibre visualization
npx claudepluginhub arthurgailes/r-package-skills --plugin r-package-skillsThis skill uses the workspace's default tool permissions.
**freestiler converts spatial data into PMTiles vector tilesets.** Rust-powered tool for creating `.pmtiles` from sf objects, files, or DuckDB SQL.
Use when code loads mapgl or freestiler, working with .pmtiles files, creating interactive maps in R, choosing between R mapping packages, or working with large spatial datasets for visualization
Performs geospatial vector analysis with GeoPandas: read/write Shapefile/GeoJSON/GeoPackage/PostGIS/Parquet, spatial joins/overlays/dissolve, geometric ops (buffer/centroid), CRS transforms, choropleth/interactive maps.
Views, previews, and inspects geospatial files from CLI with interactive raster (viewtif), vector (viewgeom), and terminal-inline (viewinline) tools for GeoTIFF, Shapefiles, GeoJSON, GeoPackage, HDF, NetCDF, CSV, and more.
Share bugs, ideas, or general feedback.
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