The geoinformation platform of the Swiss Confederation (data.geo.admin.ch) provides access to a variety of datasets.
Access to the data is granted via their API which is a ‘metadata API’ which lists the available datasets and points towards the files (data) linked specific datasets. The structure is as follows:
Each dataset is a collection
A collection consists of one or multiple items
Each item can have a series of assets (files)
Available collections
The function sg_collections() allows to retrieve all available collections.
A regex pattern can be specified to filter collections, however, in the background all collections have to be downloaded, so this does not reduce computation time.
Collection details
As an example, we are looking for all collections matching the string "erreichbarkeit-oev", a data set which provides information about accessibility by public transport.
The object returned contains a series of information:
id: Unique collection identifier
title/description: Title and short description.
license: Data license
created/updated: When the collection was created and last updated
itemType: Type of data
crs: Coordinate reference system
extent: Spatial extent
data_from/data_to: Temporal extent
(oev<-sg_collections("erreichbarkeit-oev"))
# A tibble: 1 × 11
id title description license created updated
<chr> <chr> <chr> <chr> <dttm> <dttm>
1 ch.are.erre… Acce… Accessibil… propri… 2021-10-13 14:50:08 2026-05-07 12:54:11
# ℹ 5 more variables: itemType <chr>, crs <int>, extent <list>,
# data_from <date>, data_to <date>
tibble [1 × 11] (S3: tbl_df/tbl/data.frame)
$ id : chr "ch.are.erreichbarkeit-oev"
$ title : chr "Accessibility by public transport depending on travel time and potential at destination"
$ description: chr "Accessibility per traffic zone in public transport depending on the public transport travel times from all zone"| __truncated__
$ license : chr "proprietary"
$ created : POSIXct[1:1], format: "2021-10-13 14:50:08"
$ updated : POSIXct[1:1], format: "2026-05-07 12:54:11"
$ itemType : chr "Feature"
$ crs : int 2056
$ extent :List of 1
$ data_from : Date[1:1], format: "2017-06-30"
$ data_to : Date[1:1], format: "2017-06-30"
Items
Given the id of a specific collection sg_items() is used to retrieve the items within the collection.
(items<-sg_items(oev$id))
Simple feature collection with 1 feature and 9 fields
Geometry type: POLYGON
Dimension: XY
Bounding box: xmin: 5.96 ymin: 45.82 xmax: 10.49 ymax: 47.81
Projected CRS: CH1903+ / LV95
id collection type stac_version datetime
1 erreichbarkeit-oev ch.are.erreichbarkeit-oev Feature 1.0.0 2017-06-30
title created updated assets
1 Accessibility by PT 2021-10-13 15:05:38 2026-05-07 12:54:11 assets: 1
geometry
1 POLYGON ((5.96 45.82, 5.96 ...
This collection only contains one item which itself contains one asset ($assets). The asset is a geospatial file (.gpkg).