Skip to content

CLI Usage

Elzar provides two subcommands: generate and diff.


generate

Render a style from Python definitions to Mapbox GL JSON.

python -m map_style generate --style=streets -o style/streets_classic.json

Options

Option Description Default
-s, --style Style variant (streets or satellite) Required
-o, --output Output path for style JSON Required
--compare Compare with existing file instead of writing false
--generate-sprite Also generate sprite PNG/JSON from icon library false
-v, --verbose Verbose error output false

Examples

# Generate classic streets
python -m map_style generate --style=streets -o style/streets_classic.json

# Generate satellite hybrid
python -m map_style generate --style=satellite -o style/streets_satellite.json

# Compare generated vs existing (shows missing/extra layers)
python -m map_style generate --style=streets -o style/streets.json --compare

# Full pipeline: style JSON + icon library + sprite sheet
python -m map_style generate --style=streets -o style/streets.json --generate-sprite

Output

The generate command always produces:

Output Description
<output>.json Mapbox GL style JSON
<output_dir>/woosmap.iconLibrary/ Icon library with manifest, SVGs, and PNGs

With --generate-sprite:

Output Description
sprite.png 1x sprite sheet
[email protected] 2x (Retina) sprite sheet
sprite.json 1x sprite metadata (positions, sizes)
[email protected] 2x sprite metadata

diff

Compare two style JSON files at the property level.

python -m map_style diff style/streets.json style/streets_classic.json

Options

Option Description
--ignore-order Suppress layer reorder reporting
--normalize-expressions Normalize legacy filter expressions before comparing
--sort-predicates Sort all/any children for order-independent filter comparison
--ignore-defaults Suppress diffs where one side is the Mapbox GL spec default

Examples

# Basic diff
python -m map_style diff a.json b.json

# Ignore layer ordering and spec defaults
python -m map_style diff a.json b.json --ignore-order --ignore-defaults

# Normalize filters for semantic comparison
python -m map_style diff a.json b.json --normalize-expressions --sort-predicates

Exit codes

Code Meaning
0 Identical (or successful generate)
1 Differences found (diff) or error (generate)
2 File error (diff)

Legacy mode

The old CLI syntax (without subcommands) still works:

python -m map_style --style=streets -o style/streets.json

Detected automatically and routed to generate.


Environment variables

Variable Description
PYSPRITE_LIB Override path to native sprite library