CLI tool for visualizing GDALG workflows
Project description
gdalgviz
A Python library to visualise GDAL pipelines.
Installation
Requires graphviz to be installed on the system and available on the system PATH. See the installation instructions for your operating system.
GDAL itself is not required to be installed to use this library, as it only visualises the pipeline, it does not execute it.
On Linux (example installation):
apt update
apt install graphviz --yes
dot -V
apt install pipx --yes
pipx ensurepath
pipx install gdalgviz
# for Docker images
# export PATH="$HOME/.local/bin:$PATH"
gdalgviz --version
gdalgviz --pipeline "gdal vector pipeline ! read in.gpkg ! reproject --dst-crs=EPSG:32632 ! select --fields fid,geom" pipeline.svg
On Windows (assuming pip and Python are on the system PATH):
$GVIZ_PATH = "C:\Program Files\Graphviz\bin"
$env:PATH = "$GVIZ_PATH;$env:PATH"
dot -V
pip install gdalgviz
gdalgviz --version
gdalgviz --pipeline "gdal vector pipeline ! read in.gpkg ! reproject --dst-crs=EPSG:32632 ! select --fields fid,geom" pipeline.svg
Usage
usage: gdalgviz [-h] [--pipeline PIPELINE] [--vertical] [--font FONT] [--header-color HEADER_COLOR] [--version] [--docs-root DOCS_ROOT] [input_path] output_path
Visualize GDAL datasets from the command line
positional arguments:
input_path Path to a GDALG pipeline in JSON or text format
output_path Path to save the generated diagram (e.g., output.svg)
options:
-h, --help show this help message and exit
--pipeline PIPELINE Provide a raw GDALG pipeline string instead of a file
--vertical Render the diagram top-to-bottom instead of left-to-right
--font FONT Font name for diagram nodes (default: Helvetica)
--header-color HEADER_COLOR
Background color for node headers as a hex color code (default: #cfe2ff)
--version show program's version number and exit
--docs-root DOCS_ROOT
Root URL for GDAL documentation links(default: https://gdal.org/en/latest/programs)
Examples
Passing a pipeline as a JSON file (tee.json):
gdalgviz ./examples/tee.json ./examples/tee.svg
Passing a pipeline as a string:
gdalgviz --pipeline "gdal vector pipeline ! read in.gpkg ! reproject --dst-crs=EPSG:32632 ! select --fields fid,geom" pipeline.svg
Using the vertical layout option, with a custom font and header colour:
gdalgviz ./examples/tee.json ./examples/tee-custom.svg --vertical --font "Courier" --header-color "#ffdd99"
Features
- Handles both JSON and text input. See JSON Schema for the required JSON structure.
- SVG output supports clickable nodes that link to the corresponding GDAL documentation for each command. See the example.
- Supports nested pipelines. These allow sub-pipelines to be run in parallel and merged later.
- Supports tee - the operation is named "tee" because it splits the stream, like the letter "T": one input, multiple outputs, and allows saving of intermediate results
This library does not execute the GDAL pipeline, it only visualizes it. The actual execution of the pipeline is done by GDAL itself.
from osgeo import gdal
gdal.UseExceptions()
with gdal.alg.pipeline(pipeline="read byte.tif ! reproject --dst-crs EPSG:4326 --resampling cubic") as alg:
ds = alg.Output()
Development
pip install -e .[dev]
black .
ruff check . --fix
# mypy .
pytest tests
gdalgviz ./examples/tee.json ./examples/tee.svg
gdalgviz --pipeline "gdal vector pipeline ! read in.gpkg ! reproject --dst-crs=EPSG:32632 ! select --fields fid,geom" ./examples/pipeline.svg
RoadMap
- Add JSON schema validation
- Add colour coding of the graph depending on if the command is raster, vector etc.
- Add types to the codebase
- Add pipeline command formatting
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gdalgviz-0.2.0.tar.gz.
File metadata
- Download URL: gdalgviz-0.2.0.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb655aa9239b6a0a15ef469001d0384a00c23c094aa872f16815a8d8cdcbe0ca
|
|
| MD5 |
4e2b3e5a70ed00b62af8e4a7ec2beefb
|
|
| BLAKE2b-256 |
96974553296868b4846989d0fa051be77ab240044dd2ee0ba2d34502d98948d0
|
Provenance
The following attestation bundles were made for gdalgviz-0.2.0.tar.gz:
Publisher:
main.yml on geographika/gdalgviz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gdalgviz-0.2.0.tar.gz -
Subject digest:
fb655aa9239b6a0a15ef469001d0384a00c23c094aa872f16815a8d8cdcbe0ca - Sigstore transparency entry: 975670934
- Sigstore integration time:
-
Permalink:
geographika/gdalgviz@b5e61610b2af2208e432e32a37ef906dfe9dbc51 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/geographika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@b5e61610b2af2208e432e32a37ef906dfe9dbc51 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gdalgviz-0.2.0-py3-none-any.whl.
File metadata
- Download URL: gdalgviz-0.2.0-py3-none-any.whl
- Upload date:
- Size: 12.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29d34ce4fa38a59306578e9f48967a6a5e0b1b0da6bd12c9259389ed656fde30
|
|
| MD5 |
7b3e8260af53317bb8eab8d36d83fd64
|
|
| BLAKE2b-256 |
6b01e4d5a365332ae8c4b7f90ddcd9d7ed390084c333ed339876e4b537b4cc6b
|
Provenance
The following attestation bundles were made for gdalgviz-0.2.0-py3-none-any.whl:
Publisher:
main.yml on geographika/gdalgviz
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gdalgviz-0.2.0-py3-none-any.whl -
Subject digest:
29d34ce4fa38a59306578e9f48967a6a5e0b1b0da6bd12c9259389ed656fde30 - Sigstore transparency entry: 975670935
- Sigstore integration time:
-
Permalink:
geographika/gdalgviz@b5e61610b2af2208e432e32a37ef906dfe9dbc51 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/geographika
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
main.yml@b5e61610b2af2208e432e32a37ef906dfe9dbc51 -
Trigger Event:
push
-
Statement type: