Files
garmin-img-format-parsing/stage-2-parse-stage-1/readme.md
2026-04-17 02:17:49 -07:00

2.7 KiB
Raw Blame History

Updated script: landmarks_stage2_configurable_v4.py

Whats added:

  • edit-config now supports:

    • --run-cmd-before-eval
    • --run-cmd-zoom
  • global default postprocess tags:

    • analyze --default-postprocess-tag key=value
    • edit-config --default-postprocess-tag key=value
  • interactive group review now has a preview loop:

    • Enter / e = edit current group
    • n = next example
    • p = previous example
    • o = run external visualizer again on current example
    • s = skip group
    • ! = stop editing
  • global defaults.postprocess is stored in the same config file and applied to all groups during build, then group-specific postprocess overrides it

Important placeholder support for --run-cmd-before-eval:

  • {lat}
  • {lon}
  • {z}
  • {mapset}
  • {group_id}
  • {group_label}
  • {raw_type}
  • {name}

So your GPXSee command can be written like this:

python landmarks_stage2_configurable_v4.py edit-config ^
  --config stage2_config.json ^
  --run-cmd-before-eval ".\GPXSee.exe D:\maps-bg\gmapsupp\gmapsupp.img \"geo:{lat},{lon};z={z}\"" ^
  --run-cmd-zoom 19

If you want every detected group to get a visible fallback tag by default:

python landmarks_stage2_configurable_v4.py analyze export-v7-00235051.csv ^
  --config-out stage2_config.json ^
  --default-postprocess-tag tourism=attraction

or while editing an existing config:

python landmarks_stage2_configurable_v4.py edit-config ^
  --config stage2_config.json ^
  --default-postprocess-tag tourism=attraction ^
  --run-cmd-before-eval ".\GPXSee.exe D:\maps-bg\gmapsupp\gmapsupp.img \"geo:{lat},{lon};z={z}\""

Then build as usual:

python landmarks_stage2_configurable_v4.py build export-v7-00235051.csv ^
  --config stage2_config.json ^
  --osm resolved.osm ^
  --gpx resolved.gpx ^
  --resolved-csv resolved.csv

I also verified the non-interactive path:

  • analyze runs successfully
  • default global postprocess tags are written into the generated config

One important detail:

  • the global default postprocess is now stored under:

    • defaults.postprocess.add_tags
    • defaults.postprocess.remove_tags
  • build applies those to all groups, then applies group-local postprocess

That gives you exactly the pattern you asked for:

  • visualize example
  • inspect the symbol in GPXSee
  • decide naming / icon / tags
  • move to next example in the same group
  • keep everything in the same config file

The next strong upgrade would be adding a dedicated --run-cmd-before-eval-on-enter/--no-auto-open toggle, so you can choose whether each group auto-opens the first example or only opens when you press o.