Skip to content

Split CH converters - #325

Merged
m-mohr merged 15 commits into
fiboa:mainfrom
saidy-moregeo:ch-cantons
Sep 25, 2026
Merged

m-mohr merged 15 commits into
fiboa:mainfrom
saidy-moregeo:ch-cantons

Conversation

@saidy-moregeo

@saidy-moregeo saidy-moregeo commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Updated code list that needs merging fiboa/fiboa.github.io#28

@m-mohr m-mohr changed the title CH: one converter per canton on a shared base; ZH, GE and SZ read the CH: one converter per canton on a shared base; ZH, GE and SZ read the cantons' own archives Split CH converters Sep 24, 2026
@saidy-moregeo
saidy-moregeo marked this pull request as ready for review September 24, 2026 14:18
@m-mohr

m-mohr commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Updated code list that needs merging fiboa/fiboa.github.io#28

Why does a split require a new code list?

@saidy-moregeo

Copy link
Copy Markdown
Collaborator Author

Updated code list that needs merging fiboa/fiboa.github.io#28

Why does a split require a new code list?

Not a new just added translated_name,HCAT3_name,HCAT3_code.

@m-mohr

m-mohr commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

The license for the ones with attribution, should probably be simply CC-BY.
For the ones without attribution requeirement it seems to be CC0.
For all other we can only link to the terms of use, as we don't have a license.

Terms of use are different from licenses, we only provide license information normally so we can restrict it to that where we know it.

@m-mohr

m-mohr commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

A few more things before merging (assuming the license scheme from my earlier comment gets implemented):

  • Licenses and attribution: Ensure we have this correct and explicit for every Kanton
  • Move the per-canton boilerplate (short_name, title, description, provider, attribution suffix, license, data_access) into a CANTONS table in ch_base.py. Each file then only sets canton.
  • ch_zh / ch_sz: use the new WFSConverterMixin (see Refactor WFS reading into a generic mixin #136 #321) instead of hand-built requests.
  • file_migration in GE/ZH/SZ repeats the same rename and fill steps. One shared version with a source_columns dict would cover all three.
  • Tests: one shared lnf_code.csv instead of five partial copies. _convert_swiss re-runs fixtures that test_convert.py already covers.
  • ch_base.get_urls: unknown variants fall through to geodienste, e.g. ch_zh --variant 2016 converts the current file and labels it 2016. Only an explicit None entry should do that; anything else should raise.
  • ch_sz: "2025": None points at the live geodienste file and will return 2026 data after the next update.
  • next(...) without a default raises a bare StopIteration for a missing canton
  • CHANGELOG: Maybe update the changelog entry to be a couple of short bullet points under a ch entry, place them in the correcponding category.
  • GR attribution repeats "Landwirtschaftliche Nutzungsflächen".

This comment was marked as resolved.

@m-mohr

m-mohr commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

Thanks, this looks much better. The per-canton licenses and attributions now match geodienste.ch, and the refactor covers everything from the checklist.

One thing left before merging:

ch aggregate (ch.py) was not updated

  • The license is still "opendata.swiss terms: Open use. Must provide the source.". That isn't one of the three agreed forms (CC-BY-4.0 / CC0-1.0 / link to terms).
  • It still includes every "Frei erhältlich" canton, including SG and GR, which only have terms of use. SG's terms (§18) require approval before the data is passed on or published.
  • The attribution is still the generic "Kantone, via geodienste.ch", which doesn't meet CC-BY.

With the CANTONS table this is now easy:

  • Keep only cantons that are OPEN and have CC-BY-4.0 or CC0-1.0 in CANTONS.
  • Set license = "CC-BY-4.0".
  • Build attribution by joining the included cantons' source entries.
  • Adjust the description, which says "every canton that publishes them openly".

ivorbosloper added a commit that referenced this pull request Sep 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@ivorbosloper ivorbosloper left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code goes x7 (60 lines to 400), but I now see it makes sense, in order to accomodate license and attribution differences and individual conversion/download variations.

saidy-moregeo and others added 3 commits September 25, 2026 00:35
…ms a converter exists for every canton'

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Keeps the removal of the national ch converter, which main had touched for
the AddHCATMixin rename (fiboa#320), and renames ec_mapping_csv to hcat_mapping_csv
in CHBaseConverter to match.
@saidy-moregeo

Copy link
Copy Markdown
Collaborator Author

Thanks, this looks much better. The per-canton licenses and attributions now match geodienste.ch, and the refactor covers everything from the checklist.

One thing left before merging:

ch aggregate (ch.py) was not updated

  • The license is still "opendata.swiss terms: Open use. Must provide the source.". That isn't one of the three agreed forms (CC-BY-4.0 / CC0-1.0 / link to terms).
  • It still includes every "Frei erhältlich" canton, including SG and GR, which only have terms of use. SG's terms (§18) require approval before the data is passed on or published.
  • The attribution is still the generic "Kantone, via geodienste.ch", which doesn't meet CC-BY.

With the CANTONS table this is now easy:

  • Keep only cantons that are OPEN and have CC-BY-4.0 or CC0-1.0 in CANTONS.
  • Set license = "CC-BY-4.0".
  • Build attribution by joining the included cantons' source entries.
  • Adjust the description, which says "every canton that publishes them openly".

@m-mohr as per our discussion we will drop ch to avoid having one license to cover cantons with different terms and just retain the per-canton converters.

saidy-moregeo and others added 4 commits September 25, 2026 12:32
Keeps the removal of the national ch converter, which main had touched for
the area default (fiboa#323), and drops area_calculate_missing = True from
CHBaseConverter now that it is the default.
Keeps both the Swiss and the new PT entries of expected_columns in
tests/test_convert.py.
@m-mohr
m-mohr merged commit 9c4c765 into fiboa:main Sep 25, 2026
7 checks passed
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.

4 participants