Repository navigation
[BUGFIX] GUI: show only continents in the continent combobox - #302
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR…
germany) and sub-regions of a country (baden-wuerttemberg,bayern,nordrhein-westfalen,england,greater-london,british-columbia,nunavut).The cause
#275 changed
geofabrik_regionsfrom "the entries without a parent" to "every entry that is a parent of something":That is exactly right for what #275 needed it for, but the list has a second consumer:
geofabrik.py:166,179,323baden-wuerttemberghas to be split into its four*-regbezinput.py— first comboboxThe 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_regionsis deliberately not touched — the download logic depends on it having all levels. InsteadGeofabrikJsongets a small accessor for what the GUI actually wants:geofabrik_region_overviewalready 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: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_countriesand 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 levelgeofabrik.py:166—regionname not in geofabrik_regions→ a selected container map is never downloaded as itselfThe second point is the important one: combobox 2 still offers every container map, and selecting one already triggers the split. Pick
netherlandsand you get its 12 provinces; pickgermanyand you get the ~38 state/regbez files, nevergermany-latest.osm.pbf.Measured by running the selection algorithm with both definitions of
geofabrik_regionsand summing the actual PBF sizes from geofabrik:The saving comes from the two files that disappear —
france-latest.osm.pbf(4.832 MB) andgermany-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-londonorfreiburg-regbeznow require selectingunited-kingdomresp.germany. That was the side effect @Ebe66 described in #275: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-londonstill works. If we want it in the GUI, a proper continent → country → region cascade ondevelopis the way, not a release branch.How to test
baden-wuerttemberg,bayern,england,nunavut, …europe→germany→ Create map. The log shows the German state/regbez files being downloaded, notgermany-latest.osm.pbf.europe→belgium→ Create map. Border coverage comes fromalsace,lorraine,duesseldorf-regbez,koeln-regbez,kent, … and neitherfrancenorgermanyis downloaded.python -m unittest tests.test_constants_geofabrik— includes the newtest_continents_of_geofabrik.Pull Request Checklist
🤖 Generated with Claude Code