Skip to content

[BUGFIX] GUI: show only continents in the continent combobox - #302

Merged
treee111 merged 1 commit into
release/v4.4.0from
bugfix/gui-continent-combobox
Aug 26, 2026
Merged

treee111 merged 1 commit into
release/v4.4.0from
bugfix/gui-continent-combobox

Conversation

@treee111

Copy link
Copy Markdown
Owner

This PR…

The cause

#275 changed geofabrik_regions from "the entries without a parent" to "every entry that is a parent of something":

# geofabrik_json.py
geofabrik_regions.add(parent)   # any parent, at any depth

That is exactly right for what #275 needed it for, but the list has a second consumer:

consumer needs all levels correct?
geofabrik.py:166,179,323 container maps that must not be downloaded, only their children ✅ yes — baden-wuerttemberg has to be split into its four *-regbez
input.py — first combobox continents ❌ no — this is the bug

The list grew from 9 entries to 32, and the 7 sub-country entries showed up in the combobox next to the continents.

Considerations and implementations

geofabrik_regions is deliberately not touched — the download logic depends on it having all levels. Instead GeofabrikJson gets a small accessor for what the GUI actually wants:

def get_continents(self):
    return sorted(self.geofabrik_region_overview)

geofabrik_region_overview already holds exactly the entries without a parent, so this is the same list the combobox had up to and including v4.3.0, in the same order:

africa antarctica asia australia-oceania central-america europe north-america russia south-america

The labels go back to "Select continent:" / "Select country:" accordingly.

This does not cost us anything from #275

The minimalistic-maps benefit lives entirely in find_needed_countries and never sees the GUI:

  • geofabrik.py:179 — parent in geofabrik_regions and regionname not in geofabrik_regions → border maps are always taken at the deepest available level
  • geofabrik.py:166 — regionname not in geofabrik_regions → a selected container map is never downloaded as itself

The second point is the important one: combobox 2 still offers every container map, and selecting one already triggers the split. Pick netherlands and you get its 12 provinces; pick germany and you get the ~38 state/regbez files, never germany-latest.osm.pbf.

Measured by running the selection algorithm with both definitions of geofabrik_regions and summing the actual PBF sizes from geofabrik:

wanted_map = belgium
  before #275 :  6 files   13.616 MB   belgium france germany luxembourg netherlands united-kingdom
  with  #275  : 17 files    2.793 MB   21% — 10,8 GB less

wanted_map = netherlands
  before #275 :  4 files   11.428 MB   belgium france germany netherlands
  with  #275  : 22 files    3.771 MB   33% — 7,7 GB less

The saving comes from the two files that disappear — france-latest.osm.pbf (4.832 MB) and germany-latest.osm.pbf (4.602 MB) were pulled in full just to cover a border strip. Both of these maps are selected from combobox 2, so both keep the full saving after this PR.

What is no longer possible

Creating a map of a sub-country region directly from the GUI — greater-london or freiburg-regbez now require selecting united-kingdom resp. germany. That was the side effect @Ebe66 described in #275:

a possibly desired side effect is that in the GUI you can now select regions of a country to create […] I call it a plus others might disagree

It is a question of selection scope, not of speed, and the mixed-level combobox is not a good way to offer it. The CLI is unaffected — python -m wahoomc cli -co greater-london still works. If we want it in the GUI, a proper continent → country → region cascade on develop is the way, not a release branch.

How to test

  1. Start the GUI. The first combobox contains 9 entries, all continents — no baden-wuerttemberg, bayern, england, nunavut, …
  2. Select europe → germany → Create map. The log shows the German state/regbez files being downloaded, not germany-latest.osm.pbf.
  3. Select europe → belgium → Create map. Border coverage comes from alsace, lorraine, duesseldorf-regbez, koeln-regbez, kent, … and neither france nor germany is downloaded.
  4. python -m unittest tests.test_constants_geofabrik — includes the new test_continents_of_geofabrik.

Pull Request Checklist

🤖 Generated with Claude Code

Since #275 the first combobox was filled from geofabrik_regions. That list
holds every geofabrik entry having children, so besides the continents it
also contains countries ('germany') and even sub-regions of a country
('baden-wuerttemberg', 'bayern', 'nordrhein-westfalen', 'england',
'greater-london', 'british-columbia', 'nunavut').

Add GeofabrikJson.get_continents() which returns the entries without a
parent and use it for the combobox. geofabrik_regions is left untouched -
the download logic in geofabrik.py needs it with all levels.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@treee111
treee111 merged commit 6f44d85 into release/v4.4.0 Aug 26, 2026
2 checks passed
@treee111
treee111 deleted the bugfix/gui-continent-combobox branch August 26, 2026 14:36
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.

1 participant