gdalviz gdalviz hex logo

gdalviz parses, validates, and visualizes modern GDAL CLI pipelines (gdal vector pipeline ! ... command lines and GDALG .gdalg.json files), turning them into diagrams that read like what happens to the data rather than shell syntax.

Installation

# from r-universe (binaries)
install.packages("gdalviz", repos = c("https://jimbrig.r-universe.dev", "https://cloud.r-project.org"))

# or from github
pak::pak("jimbrig/gdalviz")

Usage

Parse, lint, and render a pipeline:

library(gdalviz)

cmd <- paste(
  "gdal vector pipeline",
  "read --input /data/parcels.gpkg --input-layer parcels",
  "! filter --where \"statefp = '13'\"",
  "! make-valid",
  "! reproject --output-crs EPSG:4326",
  "! write --output /tmp/parcels.fgb --output-format FlatGeobuf"
)

p <- parse_pipeline(cmd)
lint_pipeline(p)       # one row per contract violation (none here)

g <- pipeline_graph(p) # renderer-agnostic dataflow model
render_diagrammer(g)   # static graphviz rendering

static graphviz rendering of the parcels pipeline

The interactive React Flow renderer adds pan/zoom, a minimap, and a click-to-open inspector with each step's arguments, propagated stream state, and GDAL docs link. GDALG files work directly - note the implicit streamed output sink attached where GDALG omits the final write:

system.file("extdata", "pipelines", "tiger_states.gdalg.json", package = "gdalviz") |>
  pipeline_graph() |>
  render_reactflow(theme = "dark", minimap = FALSE, direction = "TB")

interactive react flow rendering of the TIGER states GDALG pipeline

Pasted shell scripts (bash or PowerShell) parse as-is, and everything round-trips back out:

render_command_line(p)             # canonical single-line command
cat(render_script(p, shell = "bash"))  # formatted multi-line script
write_gdalg(p, "parcels.gdalg.json")   # GDALG specification

Learn more

Development

The interactive widget's TypeScript/React source lives in srcjs/ (React Flow + dagre, built with Vite/Bun); the compiled bundle is committed to inst/htmlwidgets/ so package users never need a node toolchain. Common tasks are wrapped in the Makefile (make docs, make js, make test, make check, make site), and AGENTS.md documents the architecture and conventions.

Related work