Skip to content

Commit 05d7289

Browse files
committed
update doc reference and test [gh-pahes] build trigger
1 parent 09c8a79 commit 05d7289

File tree

1 file changed

+32
-16
lines changed
  • docs/src/content/docs/export-formats

1 file changed

+32
-16
lines changed

docs/src/content/docs/export-formats/gdal.mdx

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,49 @@ The GDAL exporter creates text files compatible with GDAL's `gdaldem color-relie
1515

1616
## Output Format
1717

18-
The output is a text file with one color entry per line:
18+
The output is a text file with one color entry per line. By default, the output includes a nodata (`nv`) line but no comments:
19+
20+
```
21+
nv 0 0 0 0
22+
0.0 68 1 84 255
23+
1.0 68 2 85 255
24+
2.0 68 3 87 255
25+
...
26+
255.0 253 231 37 255
27+
```
28+
29+
When using verbose mode (`-v`), comments are included:
1930

2031
```
2132
# GDAL Color Relief File generated by Palettize
2233
# Colormap name: viridis
2334
# Domain: [0, 255], Scaler: linear
2435
# Interpolation Space for Colormap: oklch
25-
# Uncomment next line for default nodata transparency
26-
# nv 0 0 0 0
36+
nv 0 0 0 0
2737
0.0 68 1 84 255
28-
1.0 68 2 85 255
29-
2.0 68 3 87 255
3038
...
31-
255.0 253 231 37 255
3239
```
3340

3441
Each line has the format: `value R G B A`
3542

3643
## CLI Usage
3744

3845
```bash
39-
# Basic export
46+
# Basic export (includes nv line by default)
4047
palettize create viridis --format gdal --output viridis.txt --domain 0,255
4148

49+
# With verbose comments
50+
palettize create viridis -f gdal -o viridis.txt --domain 0,255 -v
51+
4252
# Custom number of colors
4353
palettize create viridis -f gdal -o viridis.txt --domain 0,255 --steps 256
4454

45-
# With nodata handling
55+
# Without nodata line
56+
palettize create viridis -f gdal -o viridis.txt --domain 0,255 -O nodata=false
57+
58+
# Custom nodata value
4659
palettize create viridis -f gdal -o viridis.txt --domain 0,255 \
47-
-O nodata_value=nv -O nodata_color="0,0,0,0"
60+
-O nodata_value=-9999 -O "nodata_color=0,0,0,0"
4861
```
4962

5063
## Python Usage
@@ -74,9 +87,10 @@ with open("viridis.txt", "w") as f:
7487
| Option | Type | Default | Description |
7588
|--------|------|---------|-------------|
7689
| `num_colors` | `int` | `256` | Number of color steps to generate |
77-
| `nodata_value` | `float \| str` | | NoData value. Use `"nv"` for GDAL keyword |
90+
| `nodata` | `bool` | `true` | Include `nv 0 0 0 0` line by default |
91+
| `nodata_value` | `float \| str` | `"nv"` | NoData value. Use `"nv"` for GDAL keyword or a numeric value |
7892
| `nodata_color` | `tuple[int,int,int,int]` | `(0,0,0,0)` | RGBA color for NoData |
79-
| `scaler_type` | `str` | | Scaler type for metadata comment |
93+
| `verbose` | `bool` | `false` | Include comment header lines (set automatically by `-v` flag) |
8094

8195
## Using with GDAL
8296

@@ -93,14 +107,16 @@ gdaldem color-relief input.tif viridis.txt output.tif \
93107

94108
## NoData Handling
95109

96-
GDAL supports a special `nv` keyword for NoData values:
110+
By default, the GDAL exporter includes an `nv 0 0 0 0` line for transparent nodata handling. GDAL's `nv` keyword applies to any nodata value defined in the raster.
97111

98112
```bash
99-
# Include NoData line in output
100-
palettize create viridis -f gdal -o viridis.txt --domain 0,255 \
101-
-O nodata_value=nv
113+
# Default behavior includes nv line
114+
palettize create viridis -f gdal -o viridis.txt --domain 0,255
115+
116+
# Disable nodata line
117+
palettize create viridis -f gdal -o viridis.txt --domain 0,255 -O nodata=false
102118

103-
# Specify numeric NoData value
119+
# Specify a numeric NoData value instead of nv
104120
palettize create viridis -f gdal -o viridis.txt --domain 0,255 \
105121
-O nodata_value=-9999 -O "nodata_color=0,0,0,0"
106122
```

0 commit comments

Comments
 (0)