CormorantDocs
Menu

Swiss geodata

Cormorant keeps an index of public Swiss geodata files: swisstopo's terrain model, orthophotos, buildings, landscape model, names and addresses (all from swisstopo's STAC API), datasets of other federal offices on geo.admin.ch, the federal building register's public export and an OpenStreetMap extract of Switzerland. You ask the index which files cover an area and which changed since your last run, and fetch only those.

Get the data for what you build#

The quickest way: say what you want to build and where. A recipe is a goal (a 3D fly-over, terrain, aerial photos, buildings and addresses, solar and energy, roads and names, nature and noise) with up to three levels of detail; a region is a canton or municipality.

curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/ask?q=3D%20buildings%20for%20a%20fly-over%20app%20in%20Luzern"
# {"goal": "flyover", "level": null, "regions": [{"id": "canton:LU", ...}], ...}

curl -s -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"recipe": "flyover", "regions": ["canton:LU"], "dry_run": true}' \
  "https://api.cormorant.ch/v1/geodata/collections"

The dry run shows per layer how many files and how many gigabytes it takes, and which layers Cormorant keeps copies of. Order without dry_run, follow state until ready (or give a callback_url), then download every file:

curl
curl -s -H "Authorization: Bearer $KEY" -o luzern.txt \
  "https://api.cormorant.ch/v1/geodata/collections/12/files?format=aria2"
aria2c -i luzern.txt -j 8 -c

The list's links need no key and last 7 days; aria2c resumes and checks each file's SHA-256. Each file counts once per list, however many requests aria2c makes. With a callback_url, Cormorant posts geodata.collection.ready once every copy is there, signed with your account's webhook secret (X-Cormorant-Signature, shown once by GET /v1/geodata/webhook-secret or the control center; see the API reference for the check). In the control center, Geodata does the same with a wizard. During the beta, collections are opened account by account, and an account's copies are limited to 50 GB unless agreed otherwise; ask us for more.

Recipes and levels#

A recipe names the layers (sources) of each level of detail; the level marked default is used when you give none. GET /v1/geodata/recipes returns the same with a summary and a note per level.

<!-- generated: geodata-recipes -->

Recipe Level Layers (source_id)
flyover: 3D fly-over light Buildings in 3D (swisstopo.buildings3d), Terrain height, 2 m (swisstopo.alti3d.2m), Aerial photos, 2 m (swisstopo.swissimage.2m)
flyover: 3D fly-over standard (default) Buildings in 3D (swisstopo.buildings3d), Terrain height, 0.5 m (swisstopo.alti3d.05m), Aerial photos, 2 m (swisstopo.swissimage.2m)
flyover: 3D fly-over max Buildings in 3D (swisstopo.buildings3d), Terrain height, 0.5 m (swisstopo.alti3d.05m), Aerial photos, 10 cm (swisstopo.swissimage.10cm)
terrain: Terrain & elevation light Terrain height, 2 m (swisstopo.alti3d.2m)
terrain: Terrain & elevation standard (default) Terrain height, 0.5 m (swisstopo.alti3d.05m)
terrain: Terrain & elevation max Terrain height, 0.5 m (swisstopo.alti3d.05m), Surface with trees, 0.5 m (swisstopo.surface3d.raster)
aerial: Aerial photo map light Aerial photos, 2 m (swisstopo.swissimage.2m)
aerial: Aerial photo map standard (default) Aerial photos, 10 cm (swisstopo.swissimage.10cm)
buildings: Buildings & addresses standard (default) Buildings in 3D (swisstopo.buildings3d), Building addresses (swisstopo.address_directory), Building register (GWR) (bfs.gwr)
solar: Solar & energy standard (default) Solar suitability of roofs (bfe.solar.roofs), Heating of buildings (bfs.gwr.heating), Buildings in 3D (swisstopo.buildings3d)
roads: Roads, rail & names standard (default) Roads, rail, water, land cover (swisstopo.tlm3d), Place names (swisstopo.names3d)
nature: Nature & noise standard (default) Road noise, day (bafu.noise.road.day), Road noise, night (bafu.noise.road.night), Vegetation height (LiDAR) (bafu.vhm.lidar)
<!-- /generated -->

Regions#

A region is one of the 26 cantons (canton:LU) or about 2,100 municipalities (municipality:1061, the federal municipality number), with borders from swisstopo's swissBOUNDARIES3D.

curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/regions?q=Lucerne"
# names in German, French, Italian or English find the same region
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/regions/canton:LU"

A region's files are those whose box overlaps one of the 1 km tiles its border touches (cells), so a canton gets its own files, not the rectangle around it. To draw it, ask for its shape as GeoJSON:

curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/regions/canton:LU?geometry=outline&crs=4326"
# {"geometry": {"type": "MultiPolygon", "coordinates": [...]}, "geometry_source": "border", ...}

A canton comes with its border (simplified to about 300 m), a municipality with its 1 km tiles. Show the attribution with any border you draw.

The files of an area, or of a collection, come as GeoJSON footprints too (format=geojson, one polygon per file): drop the answer into QGIS or a web map to check what you get before downloading.

The sources#

Every source of the index, with the size of its current edition for the whole country (measured, about ±20 %). GET /v1/geodata/sources adds how many files each holds and how current it is.

<!-- generated: sources-geodata -->

source_id What it is Format Files by Whole country Publisher
swisstopo.buildings3d swissBUILDINGS3D 3.0: buildings with roof shapes (LOD2), per map sheet FileGDB (ZIP) map sheet 14 GB swisstopo
swisstopo.buildings3d.national swissBUILDINGS3D 3.0: buildings of the whole country, one file per year FileGDB (ZIP) one file 14 GB swisstopo
swisstopo.alti3d.2m swissALTI3D: terrain model, 2 m grid, per km tile GeoTIFF (COG) 1 km tile 45 GB swisstopo
swisstopo.alti3d.05m swissALTI3D: terrain model, 0.5 m grid, per km tile GeoTIFF (COG) 1 km tile 684 GB swisstopo
swisstopo.swissimage.2m SWISSIMAGE 10 cm, resampled to 2 m: aerial images per km tile GeoTIFF (COG) 1 km tile 7 GB swisstopo
swisstopo.swissimage.10cm SWISSIMAGE 10 cm: aerial images per km tile GeoTIFF (COG) 1 km tile 2.36 TB swisstopo
swisstopo.surface3d.raster swissSURFACE3D Raster: surface model (trees, bridges, buildings), 0.5 m, per km tile GeoTIFF (COG) 1 km tile 636 GB swisstopo
swisstopo.surface3d swissSURFACE3D: LiDAR point cloud per km tile COPC LAZ or LAS (ZIP) 1 km tile 10 TB swisstopo
swisstopo.tlm3d swissTLM3D: roads, rail, water, land cover, single trees GeoPackage (ZIP) one file 4.8 GB swisstopo
swisstopo.names3d swissNAMES3D: place and feature names GeoPackage one file 460 MB swisstopo
swisstopo.boundaries3d swissBOUNDARIES3D: borders of the country, cantons, districts and municipalities Shapefile (ZIP) one file 36 MB swisstopo
swisstopo.address_directory Official building address directory: EGID and address FileGDB (ZIP) canton 150 MB swisstopo
bafu.vhm Vegetation height model of the national forest inventory (stereo), per year GeoTIFF one file 18 GB BAFU
bafu.vhm.lidar Vegetation height model of the national forest inventory (LiDAR), per year GeoTIFF one file 27 GB BAFU
bfe.solar.roofs Solar suitability of roofs (generalized) GeoPackage (ZIP) one file 1.1 GB BFE
bafu.noise.road.day Road traffic noise, day GeoTIFF one file 550 MB BAFU
bafu.noise.road.night Road traffic noise, night GeoTIFF one file 550 MB BAFU
bfs.gwr.heating Building register: heat sources of buildings CSV (ZIP) one file 60 MB BFS
bfs.gwr Federal register of buildings and dwellings (GWR), public export CSV (ZIP) one file 950 MB BFS
osm.switzerland OpenStreetMap extract of Switzerland (Geofabrik) OSM PBF one file OpenStreetMap
swisstopo.buildings3d.tiles3d swisstopo's 3D Tiles of all buildings (reference, streamed by apps) 3D Tiles (JSON) reference, not a file swisstopo
swisstopo.wmts swisstopo WMTS capabilities (maps, incl. the Zeitreise historic maps) WMTS capabilities (XML) reference, not a file swisstopo
ign.rgealti.1m RGE ALTI®: terrain model of France (bare ground), 1 m grid, per km tile GeoTIFF 1 km tile, Lambert-93 IGN
ign.rgealti.5m RGE ALTI®: terrain model of France (bare ground), 5 m grid, per 5 km tile GeoTIFF 5 km tile, Lambert-93 IGN
ign.bdortho.20cm BD ORTHO®: aerial photos of France (natural colour), 20 cm, per 5 km tile JPEG2000 5 km tile, Lambert-93 IGN
ign.bdtopo.batiment BD TOPO® V3, buildings (bâti / batiment): footprints with heights, per km tile GeoPackage 1 km tile, Lambert-93 IGN
ban.adresses Base Adresse Nationale: every address of the département, with its position CSV one file Base Adresse Nationale (IGN, DINUM, ANCT)
lgl-bw.dgm1 DGM1: terrain model of Baden-Württemberg (bare ground), 1 m grid, per 2 km tile GeoTIFF 2 km tile, ETRS89 / UTM 32N LGL
lgl-bw.lod2 LoD2: 3D buildings of Baden-Württemberg with roof shapes (CityGML), per 2 km tile CityGML 1.0 (ZIP) 2 km tile, ETRS89 / UTM 32N LGL
lgl-bw.dop20 DOP20: aerial photos of Baden-Württemberg (natural colour), 20 cm, per 2 km tile GeoTIFF (ZIP) 2 km tile, ETRS89 / UTM 32N LGL
bs.baumkataster Basel-Stadt tree register (Baumkataster): trees of the city and of Riehen GeoJSON one file Kanton Basel-Stadt
<!-- /generated -->

swisstopo.buildings3d.tiles3d and swisstopo.wmts are references: the change feed says when swisstopo publishes a new 3D Tiles build or new map layers, and your app reads those from swisstopo.

Across the border#

Along the Swiss border the index holds French and German data too: terrain models, buildings, aerial photos, addresses and the Basel-Stadt tree register. In France that is the six départements along the border (Haut-Rhin, Territoire de Belfort, Doubs, Jura, Ain, Haute-Savoie) for terrain and buildings, and the Haut-Rhin for aerial photos and addresses; in Germany it is Baden-Württemberg. Cormorant makes these files from the publishers' packages inside its coverage windows and holds them, so every file has a download_url and a SHA-256, and a new edition is in the change feed like a swisstopo file.

To order a recipe there, add country (FR or DE) to POST /v1/geodata/collections and name communes or Gemeinden (GET /v1/geodata/regions?q=Huningue&country=FR) or a box of at most 60 km a side. Cormorant makes the files after the order; see Orders abroad.

Need source_id Files
Terrain in France (DTM, 1 m; 5 m) ign.rgealti.1m, ign.rgealti.5m GeoTIFF per IGN tile, Lambert-93, NGF-IGN69 heights
Buildings in France with heights ign.bdtopo.batiment GeoPackage per 1 km tile, layer batiment
Aerial photos in France (20 cm, Haut-Rhin) ign.bdortho.20cm IGN's JPEG 2000 tiles of 5 km, Lambert-93
Addresses in France (Haut-Rhin) ban.adresses one CSV, as the Base Adresse Nationale publishes it
Terrain in Germany (DTM, 1 m) lgl-bw.dgm1 GeoTIFF per 2 km tile, UTM 32N, DHHN2016 heights
3D buildings in Germany (LoD2) lgl-bw.lod2 zip of CityGML 1.0 per 2 km tile
Aerial photos in Germany (20 cm) lgl-bw.dop20 LGL's zip of 1 km RGB GeoTIFFs per 2 km tile
Trees of Basel-Stadt bs.baumkataster one GeoJSON

Ask by an LV95 box as for Swiss data; the tiles of the other grids whose outline touches it come back, each with its box in its own grid:

curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/tiles?source_id=ign.rgealti.1m&bbox=2604000,1255500,2619800,1274400"

Or give the box in the publisher's grid with bbox_crs=2154 (Lambert-93) or bbox_crs=25832 (UTM 32N). Each file has file_name (with its extension), edition (sortable, newest wins), tile_key in the publisher's own naming, status and superseded_by, crs, box_native, footprint_lv95 and origin (what it was made from). Heights stay in the publisher's height system: NGF-IGN69 in France, DHHN2016 in Germany, LN02 in swissALTI3D; they differ by a few decimetres, so convert before joining terrain across a border where that matters.

Credit each source with its credit line (GET /v1/geodata/sources or GET /v1/geodata/sources/{source_id}/licence): IGN – RGE ALTI®, IGN – BD TOPO® (Licence Ouverte 2.0, as for BD ORTHO® and the Base Adresse Nationale), Datenquelle: LGL, www.lgl-bw.de, dl-de/by-2-0 (Datenlizenz Deutschland – Namensnennung 2.0) and Geodaten Kanton Basel-Stadt (CC BY 4.0). Basel-Landschaft publishes no tree register.

What the index holds#

For each file: the publisher's address (origin_href), the SHA-256 checksum the publisher states, its edition and its box in Swiss LV95 (EPSG:2056) metres. A tile is a square kilometre (2670-1254), a map sheet (1172-31), a canton or the whole country. A file is:

  • current: the newest edition of its tile;
  • superseded: an older edition, still served by the publisher;
  • withdrawn: no longer listed by the publisher.
curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/sources"

Each source says how current its index is: state (fresh, seeding, stale, failing, blocked) and lag_s, how far it is behind the publisher's newest change.

Files of an area#

curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/tiles?source_id=swisstopo.alti3d.2m&bbox=2665000,1210000,2668000,1213000"

Give the box in WGS84 with bbox_crs=4326 (bbox=7.43,46.94,7.46,46.96). Pages hold up to 1,000 files; pass next_cursor as cursor for the next one. Every edition of one tile: GET /v1/geodata/tiles/{source_id}/{tile_key}.

Following changes#

The change feed lists every added, changed, superseded and withdrawn file in order. Read the current files once, note the newest feed id, then poll:

curl
curl -s -H "Authorization: Bearer $KEY" \
  "https://api.cormorant.ch/v1/geodata/changes?after=912&source_id=swisstopo.buildings3d&bbox=2670000,1240000,2700000,1260000"

Pass next_after as after the next time. Each entry names the tile and its box, so you rebuild only what moved. changed means the file's content changed (its checksum differs): swisstopo sometimes re-dates many files at once without changing them, and those raise nothing. An older edition the publisher lists late is kept in the tile's editions but not announced.

Instead of polling, a watch sends the changes to your webhook:

JSON
{
  "target": {"source_id": "swisstopo.buildings3d", "bbox": [2670000, 1240000, 2700000, 1260000]},
  "schedule": {"interval": "P1D"},
  "webhook_url": "https://example.org/hooks/geodata"
}

Each changed event carries up to 1,000 entries of the feed in changes.

How current it is#

swisstopo's newest change is checked every 6 hours; what changed since the last check is then read. Every 7 days the whole collection is read again, and files that are gone are marked withdrawn. The building register and OpenStreetMap files are checked daily by their dates. The first pass over a source is not in the feed.

Copies kept by Cormorant#

Collections (above) make their areas themselves. To keep copies of a box or region of chosen sources yourself, create an area; sources switched on for mirroring are accepted:

curl
curl -s -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"source_ids": ["swisstopo.alti3d.05m"], "bbox": [2662000, 1208000, 2670000, 1215000]}' \
  "https://api.cormorant.ch/v1/geodata/aois"

The files are copied in the background; mirrored in GET /v1/geodata/aois/{id} counts them. A copied file has a download_url in GET /v1/geodata/tiles: a link valid for 15 minutes that serves range requests, so a Cloud Optimized GeoTIFF can be read in parts. Without a copy, read origin_href: swisstopo serves range requests too.

Terms and credit#

The data stays under its publisher's terms: terms and attribution of each source say which, and the credit line to show (© swisstopo). The sources across the border add licence and the exact credit line (see "Across the border"). OpenStreetMap data is under the ODbL (share_alike: true): what you derive from it and publish must be offered under the same licence.

Show it in your app#

The files are standard formats, so the usual tools read them directly.

Terrain and aerial photos are Cloud Optimized GeoTIFFs: read only the part you need over HTTP, from the publisher (origin_href) or from Cormorant's copy (download_url):

Shell
gdalinfo /vsicurl/https://data.geo.admin.ch/ch.swisstopo.swissalti3d/swissalti3d_2026_2670-1254/swissalti3d_2026_2670-1254_2_2056_5728.tif
gdal_translate -projwin 2670200 1254800 2670600 1254400 \
  /vsicurl/https://data.geo.admin.ch/ch.swisstopo.swissalti3d/swissalti3d_2026_2670-1254/swissalti3d_2026_2670-1254_2_2056_5728.tif part.tif

For a web map of the aerial photos, swisstopo's map tiles (the swisstopo.wmts reference) work in MapLibre GL JS:

JavaScript
new maplibregl.Map({
  container: "map",
  center: [8.31, 47.05],
  zoom: 13,
  style: {
    version: 8,
    sources: {
      swissimage: {
        type: "raster",
        tiles: ["https://wmts.geo.admin.ch/1.0.0/ch.swisstopo.swissimage/default/current/3857/{z}/{x}/{y}.jpeg"],
        tileSize: 256,
        attribution: "© swisstopo",
      },
    },
    layers: [{ id: "swissimage", type: "raster", source: "swissimage" }],
  },
});

Every building of the country in 3D streams from swisstopo's 3D Tiles (the swisstopo.buildings3d.tiles3d reference) in CesiumJS:

JavaScript
const viewer = new Cesium.Viewer("cesium");
const buildings = await Cesium.Cesium3DTileset.fromUrl(
  "https://3d.geo.admin.ch/ch.swisstopo.swissbuildings3d.3d/v1/tileset.json",
);
viewer.scene.primitives.add(buildings);
viewer.camera.flyTo({ destination: Cesium.Cartesian3.fromDegrees(8.307, 47.052, 900) });

Name the publisher next to what you show (© swisstopo; each source's attribution says which).

3D viewer sessions#

Cormorant's own 3D builds (buildings and terrain, in a pencil or plain style) are opened with a session: one tileset link per layer, pinned to a build for an hour, so a viewer never mixes two builds.

curl
curl -s -X POST -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"style": "pencil", "layers": ["buildings", "terrain"]}' \
  "https://api.cormorant.ch/v1/geo3d/sessions"
# {"session_id": "g3s_…", "tilesets": [{"layer": "buildings", "url": "…/tileset.json", …}],
#  "expires_at": "…", "attribution": "© swisstopo"}

Load each url like the tileset above and open a new session when it ends. GET /v1/geo3d/versions says which layers and builds exist; until a first build is published, sessions answer 503 geo3d_no_versions. Each session is one geo3d request.

Webhook secret#

The geodata.collection.ready webhook is signed with your account's secret. GET /v1/geodata/webhook-secret (an account admin key) shows it once; POST /v1/geodata/webhook-secret/rotate makes a new one, shown once, and the next delivery is signed with it. The API contract has the check in Python.

Usage#

Index reads ask no publisher. Each is recorded as one geodata request in your usage and is not charged. Reading swisstopo's STAC API directly with GET /v1/catalogs/geoadmin-stac/collections/{collection_id}/items is one fetch per call. See the API contract for every field.

View as Markdown