Skip to content

Conversation

@iret33
Copy link

@iret33 iret33 commented Jan 24, 2026

Summary

Adds a new --svg-layers CLI flag that creates plotter-friendly SVG output with roads organized into separate layers by line width. This is ideal for:

  • Pen plotters (AxiDraw, etc.) - plot each road type with different pen sizes
  • Laser cutters - separate passes for different line weights
  • Vector editing (Illustrator, Inkscape) - easily select/modify road categories

Road Layers (sorted by line size)

Layer Road Types Line Width
Residential & Other residential, footway, paths 0.4
Tertiary Roads tertiary 0.6
Secondary Roads secondary 0.8
Primary Roads trunk, primary 1.0
Motorways motorway 1.2

Each layer has an identifiable gid attribute in the SVG for easy selection.

Usage

# Generate plotter-friendly SVG with separate layers
python create_map_poster.py -c "Berlin" -C "Germany" -f svg --svg-layers -d 10000

Example Output Files

Sample SVG files included in this PR (see examples/svg-layers/):

All files contain 5 properly separated SVG layers:

grep -o 'id="layer_[^"]*"' examples/svg-layers/manama_bahrain.svg
# id="layer_residential_Residential_&_Other_width_0.4"
# id="layer_tertiary_Tertiary_Roads_width_0.6"
# id="layer_secondary_Secondary_Roads_width_0.8"
# id="layer_primary_Primary_Roads_width_1.0"
# id="layer_motorway_Motorways_width_1.2"

Additional Tested Cities

Bahrain (Top 5 Cities):

  • Manama, Muharraq, Riffa, Hamad Town, Isa Town

Top 5 Arab Cities:

  • Cairo (Egypt), Riyadh (Saudi Arabia), Dubai (UAE), Baghdad (Iraq), Jeddah (Saudi Arabia)

Use Cases

Pen Plotter Workflow

  1. Generate SVG with --svg-layers
  2. Open in Inkscape
  3. Plot residential roads with 0.3mm pen
  4. Swap to 0.5mm pen, plot primary roads
  5. Swap to 0.8mm pen, plot motorways

Laser Cutter Workflow

  1. Generate layered SVG
  2. Assign different power/speed settings per layer
  3. Cut with varying line depths

Test Plan

  • Generate SVG without --svg-layers (standard behavior unchanged)
  • Generate SVG with --svg-layers and verify layers appear as separate groups
  • Verify layer IDs present in SVG output
  • Tested with 10 different cities across multiple countries
  • PNG/PDF output unaffected by the new flag

🤖 Generated with Claude Code

@iret33 iret33 changed the title Add --svg-layers option for layered SVG output by line size Add --svg-layers option for plotter-friendly SVG output with layers sorted by line size Jan 24, 2026
@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@iret33 iret33 force-pushed the feature/svg-layers-by-line-size branch from e1526e5 to 096aed1 Compare January 26, 2026 15:14
@github-actions
Copy link

Conflicts have been resolved.

@merwok
Copy link

merwok commented Jan 26, 2026

(Could the github action be configured to edit labels but not add comments?)

@iret33
Copy link
Author

iret33 commented Jan 26, 2026

That's a question for the repo maintainer (@originalankur) - the conflict-checking workflow is configured on the upstream repository, not on my fork.

@github-actions
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

iret33 and others added 2 commits January 29, 2026 16:54
When generating SVG output with the --svg-layers flag, roads are now
organized into separate SVG groups based on their line width/road type:
- Motorways (width 1.2)
- Primary Roads (width 1.0)
- Secondary Roads (width 0.8)
- Tertiary Roads (width 0.6)
- Residential & Other (width 0.4)

Each layer is identifiable by its gid attribute in the SVG, making it
easy to select, edit, or hide specific road types in vector graphics
editors like Adobe Illustrator or Inkscape.

Usage: python create_map_poster.py -c "Berlin" -C "Germany" -f svg --svg-layers

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Includes 3 sample cities demonstrating the --svg-layers feature:
- Manama, Bahrain (5.8 MB)
- Dubai, UAE (8.5 MB)
- Cairo, Egypt (14 MB)

Each SVG contains 5 road layers sorted by line size for
plotter-friendly workflows.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@iret33 iret33 force-pushed the feature/svg-layers-by-line-size branch from 096aed1 to 0b1096d Compare January 29, 2026 13:54
@github-actions
Copy link

Conflicts have been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants