| Title: | Visualize Modern GDAL Pipelines |
|---|---|
| Description: | Produces interactive or static visualizations of modern GDAL CLI pipelines. |
| Authors: | Jimmy Briggs [aut, cre] |
| Maintainer: | Jimmy Briggs <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-07-12 05:04:57 UTC |
| Source: | https://github.com/jimbrig/gdalviz |
Convert a pipeline to a GDALG specification list
as_gdalg(x, relative_paths = TRUE, gdal_version = NULL)as_gdalg(x, relative_paths = TRUE, gdal_version = NULL)
x |
A |
relative_paths |
Logical for the
|
gdal_version |
Optional GDAL version string to record. |
A named list with type, command_line, and optional members,
suitable for serialization to a *.gdalg.json file.
Look up a single pipeline step in the contract
contract_step(command, contract = gdalviz_contract())contract_step(command, contract = gdalviz_contract())
command |
Step command name (e.g. |
contract |
A |
The step definition list, or NULL if the command is unknown.
Loads the bundled gdal vector pipeline --json-usage snapshot and turns it
into a lookup of pipeline steps and their arguments. This is the single
source of truth for which steps and arguments are valid, their types,
choices, and documentation URLs.
gdalviz_contract(path = NULL, refresh = FALSE)gdalviz_contract(path = NULL, refresh = FALSE)
path |
Optional path to a |
refresh |
If |
A gdalviz_contract object: a named list of step definitions.
Runs gdal <type> pipeline --json-usage against the GDAL CLI on the user's
PATH (or an explicit binary) and writes the result as a new contract
snapshot, so the contract registry matches the locally installed GDAL
version instead of the snapshot bundled with the package.
gdalviz_refresh_contract( path = NULL, type = c("vector", "raster"), gdal = NULL )gdalviz_refresh_contract( path = NULL, type = c("vector", "raster"), gdal = NULL )
path |
Destination for the snapshot JSON. Defaults to the bundled snapshot location, replacing it for the current installation. |
type |
Pipeline type ( |
gdal |
Path to the |
The refreshed gdalviz_contract, invisibly.
Produces a structured issue table for unknown steps, unknown arguments, missing required arguments, and value/type mismatches.
lint_pipeline(x, contract = gdalviz_contract())lint_pipeline(x, contract = gdalviz_contract())
x |
A |
contract |
A |
A tibble with one row per lint issue.
Accepts a raw pipeline command line (with or without the
gdal [vector|raster] pipeline prefix) and parses it into an ordered list of
steps, resolving nested pipelines ([ ... ]) and associating arguments with
their values using the GDAL contract to disambiguate boolean flags.
parse_pipeline(x, contract = gdalviz_contract())parse_pipeline(x, contract = gdalviz_contract())
x |
A pipeline command-line string. |
contract |
A |
A gdalviz_pipeline object.
Normalizes a gdal ... pipeline invocation written as a shell or powershell
script – joining line continuations, stripping comments, and collapsing
here-strings / heredocs into single tokens – then parses it with
parse_pipeline().
parse_script( text, shell = c("bash", "powershell"), contract = gdalviz_contract() )parse_script( text, shell = c("bash", "powershell"), contract = gdalviz_contract() )
text |
The script text (a single string or a character vector of lines). |
shell |
Source shell: |
contract |
A |
A gdalviz_pipeline.
Generate the DOT specification for a pipeline graph
pipeline_dot(graph, direction = c("TB", "LR"), theme = c("light", "dark"))pipeline_dot(graph, direction = c("TB", "LR"), theme = c("light", "dark"))
graph |
A |
direction |
Layout direction: |
theme |
|
A length-one character string of DOT.
Converts a parse_pipeline() result into a graph of nodes and edges,
classifying each step, rendering its arguments as code, generating a
plain-language description, and propagating the feature-stream state
(CRS, geometry type, field schema, validity, ordering) along the pipeline.
pipeline_graph(x, contract = gdalviz_contract(), merge_repeated = TRUE)pipeline_graph(x, contract = gdalviz_contract(), merge_repeated = TRUE)
x |
A |
contract |
A |
merge_repeated |
Merge runs of 3+ consecutive identical commands (e.g.
the one-field-at-a-time |
A gdalviz_graph: a list with nodes and edges tibbles.
Output and render functions for using render_reactflow() widgets within
Shiny applications.
pipelineFlowOutput(outputId, width = "100%", height = "560px") renderPipelineFlow(expr, env = parent.frame(), quoted = FALSE)pipelineFlowOutput(outputId, width = "100%", height = "560px") renderPipelineFlow(expr, env = parent.frame(), quoted = FALSE)
outputId |
Output variable to read from. |
width, height
|
CSS dimensions for the widget container. |
expr |
An expression that returns a |
env |
The environment in which to evaluate |
quoted |
Whether |
pipelineFlowOutput() returns a Shiny output element;
renderPipelineFlow() returns a Shiny render function.
Accepts a path to a GDALG JSON file ({"type":"gdal_streamed_alg", "command_line": "..."}), a path to a raw pipeline text file, or a raw
pipeline string, and returns a parsed gdalviz_pipeline.
read_gdalg(x, contract = gdalviz_contract())read_gdalg(x, contract = gdalviz_contract())
x |
A path to a GDALG/JSON/text file, or a raw pipeline string. |
contract |
A |
A gdalviz_pipeline.
Read a shell or powershell script file into a pipeline
read_script(path, shell = NULL, contract = gdalviz_contract())read_script(path, shell = NULL, contract = gdalviz_contract())
path |
Path to a |
shell |
Source shell: |
contract |
A |
A gdalviz_pipeline.
Serializes a parsed parse_pipeline() result back into a single-line
command_line string, using the same minimal quoting that GDAL itself uses
when it writes *.gdalg.json files. The result round-trips: parsing the
output again yields an equivalent pipeline.
render_command_line(x, prog = TRUE, type = NULL)render_command_line(x, prog = TRUE, type = NULL)
x |
A |
prog |
Logical or |
type |
Pipeline type ( |
A length-one character vector.
Builds a DOT specification with card-style HTML nodes (verb header, code body, plain-language description), category colors, and state-annotated edges, rendered via DiagrammeR. Suitable for static export to SVG/PNG.
render_diagrammer(graph, direction = c("TB", "LR"), theme = c("light", "dark"))render_diagrammer(graph, direction = c("TB", "LR"), theme = c("light", "dark"))
graph |
A |
direction |
Layout direction: |
theme |
|
A DiagrammeR grViz htmlwidget.
Produces a modern, interactive node-link diagram using a dagre (hierarchical) layout. Nodes are card-style, colored by category, labelled with the step verb and a plain-language description; edges carry state-change badges.
render_g6( graph, direction = c("TB", "LR", "BT", "RL"), theme = c("light", "dark"), height = NULL, width = "100%" )render_g6( graph, direction = c("TB", "LR", "BT", "RL"), theme = c("light", "dark"), height = NULL, width = "100%" )
graph |
A |
direction |
Layout direction: |
theme |
|
height, width
|
Widget dimensions. |
A g6 htmlwidget.
Produces a modern, interactive dataflow diagram of a GDAL pipeline using React Flow (xyflow). Steps render as card-style nodes colored by category with their arguments inline; edges carry state-change badges (CRS, geometry type, field count); tee branches render as dashed side flows. Clicking a node opens an inspector panel with the full argument list, the propagated stream state, and a link to the GDAL documentation for that step.
render_reactflow( graph, direction = c("TB", "LR", "BT", "RL"), theme = c("light", "dark"), minimap = TRUE, controls = TRUE, legend = TRUE, draggable = TRUE, width = NULL, height = NULL, elementId = NULL )render_reactflow( graph, direction = c("TB", "LR", "BT", "RL"), theme = c("light", "dark"), minimap = TRUE, controls = TRUE, legend = TRUE, draggable = TRUE, width = NULL, height = NULL, elementId = NULL )
graph |
A |
direction |
Layout direction: |
theme |
|
minimap |
Show a minimap overview. Defaults to |
controls |
Show zoom/fit controls. Defaults to |
legend |
Show the category legend. Defaults to |
draggable |
Allow nodes to be repositioned by dragging. Defaults to
|
width, height
|
Widget dimensions passed to
|
elementId |
Optional explicit element id for the widget container. |
The JavaScript bundle is built from srcjs/ (see
srcjs/README.md) and shipped with the package, so no node toolchain is
needed at run time.
A pipeline_flow htmlwidget.
## Not run: gdalg <- system.file( "extdata", "pipelines", "tiger_states.gdalg.json", package = "gdalviz" ) pipeline_graph(gdalg) |> render_reactflow(theme = "dark") ## End(Not run)## Not run: gdalg <- system.file( "extdata", "pipelines", "tiger_states.gdalg.json", package = "gdalviz" ) pipeline_graph(gdalg) |> render_reactflow(theme = "dark") ## End(Not run)
Produces an indented, line-continued gdal <type> pipeline invocation for
either bash/sh or powershell, with one ! step per line and
shell-appropriate quoting. Optionally reflows large SQL into a heredoc
(bash) or here-string (powershell) for readability.
render_script( x, shell = c("bash", "powershell"), indent = " ", type = NULL, globals_per_line = 3L, sql = c("inline", "block") )render_script( x, shell = c("bash", "powershell"), indent = " ", type = NULL, globals_per_line = 3L, sql = c("inline", "block") )
x |
A |
shell |
Target shell: |
indent |
Indentation unit for steps. Defaults to two spaces. |
type |
Pipeline type ( |
globals_per_line |
Number of global options to place per continuation
line. Defaults to |
sql |
Either |
A length-one character vector containing the full script.
Validates a parsed pipeline and returns a structured validation object. By default it errors when validation fails.
validate_pipeline(x, contract = gdalviz_contract(), strict = TRUE)validate_pipeline(x, contract = gdalviz_contract(), strict = TRUE)
x |
A |
contract |
A |
strict |
If |
A gdalviz_validation object with valid and issues.
Write a pipeline to a GDALG JSON file
write_gdalg(x, path, relative_paths = TRUE, gdal_version = NULL, pretty = TRUE)write_gdalg(x, path, relative_paths = TRUE, gdal_version = NULL, pretty = TRUE)
x |
A |
path |
Output path (conventionally ending in |
relative_paths |
Logical for the
|
gdal_version |
Optional GDAL version string to record. |
pretty |
Whether to pretty-print the JSON. Defaults to |
The path, invisibly.