data: add ingestion pipeline and Chile from IDE Chile DPA 2023 - #11
Merged
Conversation
Brings the first real data under the conventions written in PR #1, and builds the pipeline the remaining continents will reuse. The catalog no longer says "not populated yet". Chile: 16 regions, 56 provinces, 345 communes ------------------------------------------------ Sourced from IDE Chile's División Política Administrativa 2023 (CC BY), not geoBoundaries. geoBoundaries was evaluated and rejected for Chile: its ADM1 and ADM3 are fine, but its ADM2 is OpenStreetMap under ODbL and its communes are a 2020 vintage. DPA 2023 gives all three tiers from one source, one vintage, with CUT codes already stored as zero-padded strings — and it is the first openly licensed source for the provincial tier, which the repository never had. 345 communes rather than the official 346 is expected, not a defect: the Antártica commune (12202) is absent because the DPA package excludes Chile's Antarctic claim, and the data stops at 56.5°S. Documented in the manifest. The municipal level is split by region into 16 files, plus a whole-country file because it fits under the CDN ceiling. CI verifies the parts sum to exactly 345. Resolution: a distance, not a percentage ---------------------------------------- Everything is simplified to a 100 m ground tolerance, recorded per dataset. The first implementation bisected on a simplification percentage until the output fit a size budget. That was wrong twice over: it maximised every file up to the ceiling (Chile ADM1 landed at 18.4 MB for 16 polygons, which would have put the Americas near 800 MB), and a percentage keeps a fixed share of each source's vertices, so resolution would vary by how densely each country happened to be digitised. A ground distance gives the whole repository one consistent real-world resolution. Calibrated on Chile's fjords: 49.7 MB at 10 m, 10.0 MB at 50 m, 4.6 MB at 100 m. Licensing --------- geoBoundaries' gbOpen is a container of per-file licences, not a uniformly CC BY 4.0 dataset — 43 of its 129 Americas entries are ODbL or CC-BY-SA. docs/contributing/sources.md said otherwise and was wrong; it is corrected. Copyleft is excluded, and validate-data.yml enforces the allow-list. That costs coverage: thirteen Americas countries have no ADM1 this project can redistribute. Those gaps are on the roadmap, to be closed by finding permissive sources rather than relaxing the rule. Also ---- - Preview maps now render. mkdocs.yml referenced geojson-map.js only in a comment; the file did not exist and there was no extra_javascript key. Previews are served from the docs site rather than the CDN, so they work under `mkdocs serve` and during PR review instead of 404ing until after a merge. - gen_catalog.py: support split levels, and fix a latent TypeError where sorted() could fall through to comparing manifest dicts. - Chile's legacy root files are untouched and deprecated, per the window promised in about/versioning.md. 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.
First real data under the conventions from #1, plus the pipeline the remaining continents will reuse. The catalog no longer says "not populated yet".
This is the tooling half of the Americas work. The continent's other 56 territories land in a follow-up PR that is data-only, so it can be reviewed for coverage and licensing rather than code.
Chile — 16 regions, 56 provinces, 345 communes
Sourced from IDE Chile's División Política Administrativa 2023 (CC BY), not geoBoundaries.
geoBoundaries was evaluated and rejected for Chile specifically: its ADM1 and ADM3 are fine, but its ADM2 is OpenStreetMap under ODbL and its communes are a 2020 vintage. DPA 2023 gives all three tiers from one source in one vintage, with CUT codes already stored as zero-padded strings — and it is the first openly licensed source for the provincial tier, which this repository never had.
345 communes rather than the official 346 is expected, not a defect. The Antártica commune (
12202) is absent because the DPA package excludes Chile's Antarctic claim; the data stops at 56.5°S. geoBoundaries omits it for the same reason. This is documented in the manifest and on the roadmap as won't-fix.The municipal level is split by region into 16 files (
ADM3/CL-RM.geojson…), plus a whole-country file because it fits under the CDN ceiling. CI verifies the parts sum to exactly 345 — that is how a split that loses or duplicates a municipality gets caught.Resolution is a distance, not a percentage
Everything is simplified to a 100 m ground tolerance, recorded per dataset in the manifest.
The first implementation bisected on a simplification percentage until the output fit a size budget. That was wrong twice over:
A ground distance gives the whole repository one consistent real-world resolution. Calibrated against Chile's fjords, one of the worst coastlines on Earth: 49.7 MB at 10 m, 10.0 MB at 50 m, 4.6 MB at 100 m, 1.6 MB at 250 m.
Licensing correction
docs/contributing/sources.mdwas factually wrong and is corrected here.geoBoundaries'
gbOpenis a container of heterogeneous per-file licences, not a uniformly CC BY 4.0 dataset. Measured across its 129 Americas entries, 43 (33%) are copyleft — 35 ODbL, 8 CC-BY-SA, almost all OpenStreetMap-derived. Chile is a neat illustration: ADM1 and ADM3 are CC BY 3.0 IGO, ADM2 is ODbL.Copyleft is excluded and
validate-data.ymlenforces the allow-list. That costs real coverage — thirteen Americas countries have no ADM1 this project can redistribute. Those gaps are named on the roadmap and get closed by finding permissive sources, not by relaxing the rule.Preview maps now actually render
mkdocs.ymlreferencedgeojson-map.jsonly inside a comment: the file did not exist and there was noextra_javascriptkey, so every<div class="geojson-map">rendered as an empty 420 px box.Leaflet is vendored locally and the previews are served from the docs site, not jsDelivr. Pointing at the CDN would mean the maps 404 under
mkdocs serveand throughout PR review, since the data is not on the default branch until after the merge.gen_catalog.py fixes
TypeError:sorted()on entries whose third element was a manifest dict would fall through to comparing dicts. Harmless at one country, a real hazard at fifty-seven.ds['features']/ds['path']/ds['level']no longer take down the whole docs build.Verification
mkdocs build --strictclean, including anchor validationscripts/validate_data.py— 0 errors, 0 warnings; negative-tested by setting the licence toODbL-1.0, which fails with exit 1 as intendedbuild_manifest.pyrun twice produces a byte-identical manifest with curated fields intactsite/is 6.2 MB — the 24 MB data tree did not leak intodocs_dirfetch_sources.py --continent americas --dry-runenumerates 40 accepted and 23 rejected datasets; the dry run caught a bug in my own allow-list, where Canada's "Open Government Canada 2.0" was being rejected as unrecognisedNot in this PR
Chile's legacy root files are untouched and remain deprecated, per the window promised in
about/versioning.md.CHL_ADM0arrives with the Natural Earth pass in the Americas PR.🤖 Generated with Claude Code