Reads the metadata from a PMTiles archive produced by freestile_h3() and
builds a mapgl map with one fill layer per H3 resolution plus a circle
layer for raw points. Automatically detects whether the archive was built
with fade = FALSE (disjoint zoom windows, clean breaks) or fade = TRUE
(overlapping windows, cross-fade) and styles accordingly.
Usage
view_h3_tiles(
input,
agg_column = NULL,
stops = NULL,
palette = "viridis",
hex_opacity = 0.9,
point_color = "#0868ac",
point_radius = NULL,
background_style = NULL,
hex_layer_prefix = "h3",
point_layer_name = "points",
port = 8080
)Arguments
- input
Path to a local
.pmtilesfile produced byfreestile_h3().- agg_column
Character or NULL. Aggregation column to drive the hex color scale. If
NULL, the first non-h3_idnumeric field in the metadata is used.- stops
List with
valuesandcolors(equal length, sorted byvalues) defining the shared color scale across all hex layers. IfNULL, the documented quick-look default is used.- palette
Character. Named palette used to generate default
colorswhenstopsisNULL. Currently supports"viridis"(default),"magma","plasma","cividis","inferno","rocket","mako","turbo"ifviridisLiteis installed; otherwise falls back to a five-color blue ramp.- hex_opacity
Numeric. Peak fill opacity for hex layers (default 0.9). In fade mode this is the opacity at each layer's center zoom.
- point_color
Character. Color for the raw-point circles (default
"#0868ac").- point_radius
mapgl expression or NULL. If
NULL, a zoom-interpolated default is used.- background_style
mapgl style passed to
mapgl::maplibre(); ifNULLusesmapgl::maplibre()defaults.- hex_layer_prefix
Character. Prefix used when the archive was written. Must match the value passed to
freestile_h3(); default"h3".- point_layer_name
Character. Name of the raw-points MVT layer in the archive. Must match the value passed to
freestile_h3(); default"points".- port
Integer. Port for the local PMTiles server (default 8080).
Details
The default color scale is a documented quick-look ramp (5 evenly spaced
breaks across 1, 10, 100, 1000, 10000). For production maps, pass an
explicit stops = list(values = ..., colors = ...) derived from your data.
Embedding real aggregation statistics in PMTiles metadata is on the
roadmap.
