Skip to content

habi/swissboundaries

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

275 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swiss Municipality Boundary Comparison

Comparison of Swiss municipality boundaries between official Swisstopo data (swissBOUNDARIES3D) and OpenStreetMap

This repository uses the ideas presented in https://github.com/stalker314314/osm-admin-boundary-conflation and support from Claude.ai, ChatGPT and Google Gemini to produce a report on the matching of the official swisstopo boundaries to the boundaries mapped in OpenStreetMap.

The initial prompts to Claude.ai were:

I have the boundaries of the swiss municipalities in https://data.geo.admin.ch/ch.swisstopo.swissboundaries3d/swissboundaries3d_2025-04/swissboundaries3d_2025-04_2056_5728.gpkg.zip. Help me produce a report on how well these match geographically with the boundaries mapped in OpenStreetMap, preferrably via Overpass Turbo. The boundaries in the geopackage have bfs_nummer=355, the boundaries in OSM have swisstopo:BFS_NUMMER=355 as a matching ID.

Can you query Overpass in Python, too?

Can you make this all work in a GitHub action?


Latest Results

You can check the latest comparison results, or view the most recent run summary in [the Actions tab]. The latest results are shown as a (searchable) table on http://boundaries.osm.ch/ Historic data is saved as CSV files to the history directory.

Automation

  • Schedule: Runs daily at 2 AM UTC via a GitHub Action
  • Manual Trigger: Can be triggered manually from the Actions tab
  • Data Sources:

Metrics

The comparison calculates:

🚀 Running Locally

# Install dependencies
pip install geopandas shapely pandas requests pyogrio

# Download and extract Swisstopo data
wget https://data.geo.admin.ch/ch.swisstopo.swissboundaries3d/swissboundaries3d_2026-01/swissboundaries3d_2026-01_2056_5728.gpkg.zip
unzip swissboundaries3d*.zip

# Run comparison (use the script from the GitHub Action)
python compare_boundaries.py

Output Files

Contributing

Contributions are welcome! If you find boundary discrepancies:

  1. Check the detailed results to identify problematic municipalities
  2. Verify the boundaries in OpenStreetMap
  3. Improve OSM data if needed using JOSM or iD editor
  4. The next automated run will reflect your improvements

Matching Criteria

Boundaries are matched using:

  • Swisstopo: bfs_nummer field (official BFS municipality number)
  • OpenStreetMap: swisstopo:BFS_NUMMER tag

License

Data sources:

Links

About

Vibe-coding to match boundaries from swissBOUNDARIES3D to OpenStreetMap.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors