{"id":22518060,"url":"https://github.com/zumbov2/swissgd","last_synced_at":"2025-08-03T18:32:12.056Z","repository":{"id":217522071,"uuid":"348252553","full_name":"zumbov2/swissgd","owner":"zumbov2","description":"R Interface to the Geo-Information Platform of the Swiss Confederation","archived":false,"fork":false,"pushed_at":"2022-11-21T02:01:24.000Z","size":3464,"stargazers_count":17,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"main","last_synced_at":"2024-01-17T01:22:53.442Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zumbov2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2021-03-16T07:28:46.000Z","updated_at":"2024-01-17T01:22:58.644Z","dependencies_parsed_at":"2024-01-17T01:22:58.332Z","dependency_job_id":"ef9a5e87-53a5-4874-9ef2-216c220f0259","html_url":"https://github.com/zumbov2/swissgd","commit_stats":null,"previous_names":["zumbov2/swissgd"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissgd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissgd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissgd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zumbov2%2Fswissgd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zumbov2","download_url":"https://codeload.github.com/zumbov2/swissgd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228557113,"owners_count":17936452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-07T04:14:03.926Z","updated_at":"2024-12-07T04:14:04.455Z","avatar_url":"https://github.com/zumbov2.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CRAN_Status_Badge](http://www.r-pkg.org/badges/version/swissgd)](https://cran.r-project.org/package=swissgd)\n![Lifecycle](https://img.shields.io/badge/lifecycle-maturing-orange.svg)\n\n# swissgd\nThis R package is an interface to parts of the [Geo-Information Platform of the Swiss Confederation](https://www.geo.admin.ch/en/geo-services/geo-services/download-services.html) and **work-in-progress**. It provides functions to search and download geodata from [data.geo.admin.ch](https://data.geo.admin.ch/) and wraps around the [Spatial Temporal Asset Catalog (STAC) API](https://data.geo.admin.ch/api/stac/v0.9/).\n \nThe acquisition and use of data or services is free of charge, subject to the provisions on fair use. For more information, please see the [Terms of Use](https://www.geo.admin.ch/en/geo-services/geo-services/terms-of-use.html).\n\n## Installation\nInstall from GitHub for a regularly updated version (latest: 0.1.2):\n\n```r\ninstall.packages(\"devtools\")\ndevtools::install_github(\"zumbov2/swissgd\")\n\n```\n\n# Functions\n\n## `get_available_geodata`\nRetrieves the names of all available datasets (*currently 570*) and returns the function (`download_geodata()` or `get_stac_assets()`) to obtain them.\n\n``` r\nswissgd::get_available_geodata()\n\n#\u003e # A tibble: 570 x 2\n#\u003e    name                                             retrieval_function        \n#\u003e    \u003cchr\u003e                                            \u003cchr\u003e                     \n#\u003e  1 ch.are.agglomerationsverkehr                     swissgd::get_stac_assets()\n#\u003e  2 ch.are.alpenkonvention                           swissgd::get_stac_assets()\n#\u003e  3 ch.are.belastung-personenverkehr-bahn            swissgd::get_stac_assets()\n#\u003e  4 ch.are.belastung-personenverkehr-bahn_zukunft    swissgd::get_stac_assets()\n#\u003e  5 ch.are.belastung-personenverkehr-strasse         swissgd::get_stac_assets()\n#\u003e  6 ch.are.belastung-personenverkehr-strasse_zukunft swissgd::get_stac_assets()\n#\u003e  7 ch.are.erreichbarkeit-miv                        swissgd::get_stac_assets()\n#\u003e  8 ch.are.erreichbarkeit-oev                        swissgd::get_stac_assets()\n#\u003e  9 ch.are.gemeindetypen                             swissgd::get_stac_assets()\n#\u003e 10 ch.are.gueteklassen_oev                          swissgd::get_stac_assets()\n#\u003e # ... with 560 more rows\n```\n\n## `search_geodata`\nSearches for matches to argument `pattern` within the names of available datasets on the geo-information platform.\n\n``` r\nswissgd::search_geodata(pattern = \"ÖV\")\n\n#\u003e # A tibble: 6 x 2\n#\u003e   name                                     retrieval_function         \n#\u003e   \u003cchr\u003e                                    \u003cchr\u003e                      \n#\u003e 1 ch.are.erreichbarkeit-oev                swissgd::get_stac_assets() \n#\u003e 2 ch.are.gueteklassen_oev                  swissgd::get_stac_assets() \n#\u003e 3 ch.are.reisezeit-agglomerationen-oev     swissgd::get_stac_assets() \n#\u003e 4 ch.are.reisezeit-oev                     swissgd::get_stac_assets() \n#\u003e 5 ch.bav.haltestellen-oev                  swissgd::get_stac_assets() \n#\u003e 6 ch.bav.kataster-belasteter-standorte-oev swissgd::download_geodata()\n```\n\n``` r\nswissgd::search_geodata(pattern = \"Alti\")\n\n#\u003e # A tibble: 1 x 2\n#\u003e   name                     retrieval_function        \n#\u003e   \u003cchr\u003e                    \u003cchr\u003e                     \n#\u003e 1 ch.swisstopo.swissalti3d swissgd::get_stac_assets()\n```\n\n## `show_metadata` and `show_preview`\nThese functions can be used to visit the entry of a dataset in the [Swiss Geometadata Catalogue](https://www.geocat.admin.ch) and preview the data on the mapping platform of the Swiss Confederation](https://map.geo.admin.ch).\n``` r\nswissgd::show_metadata(\"ch.are.erreichbarkeit-oev\")\nswissgd::show_preview(\"ch.are.erreichbarkeit-oev\")\n```\n\n## `download_geodata`\nDownloads datasets available directly from the geo-information platform. Other data can be obtained via the STAC API. See the functions below.\n\n``` r\nswissgd::download_geodata(\"ch.astra.baulinien-nationalstrassen\")\n```\n\n## `get_stac_collections`\nDisplays a description of all data provided via the [Spatial Temporal Asset Catalog (STAC) REST Interface](https://data.geo.admin.ch/api/stac/v0.9/collections) on the geo-information platform (*currently 100*).\n\n``` r\nswissgd::get_stac_collections() %\u003e% dplyr::select(title, id, description)\n\n#\u003e # A tibble: 100 x 3\n#\u003e    title                                                           id    descr~1\n#\u003e    \u003cchr\u003e                                                           \u003cchr\u003e \u003cchr\u003e  \n#\u003e  1 2000-Watt Sites                                                 ch.b~ \"The 2~\n#\u003e  2 2G - GSM / EDGE availability                                    ch.b~ \"The b~\n#\u003e  3 3D buildings                                                    ch.s~ \"swiss~\n#\u003e  4 3G - UMTS / HSPA availability                                   ch.b~ \"The b~\n#\u003e  5 4G - LTE / LTE-A availability                                   ch.b~ \"The b~\n#\u003e  6 5G - NR availability                                            ch.b~ \"The b~\n#\u003e  7 Accessibility by public transport depending on travel time and~ ch.a~ \"Acces~\n#\u003e  8 Accessibility by road depending on travel time and potential a~ ch.a~ \"Acces~\n#\u003e  9 Aeronautical Chart ICAO Switzerland 1:500'000                   ch.b~ \"The o~\n#\u003e 10 Alpine Convention                                               ch.a~ \"The p~\n#\u003e # ... with 90 more rows, and abbreviated variable name 1: description\n```\n\n## `get_stac_assets`\nCalls the STAC API on the geo-information platform and returns the download links to geo-specific assets. Here the aerial photo with a ground resolution of 10 cm of a part of my hometown Aarau is queried. WGS84, LV03 and LV95 coordinates are possible.\n\n``` r\nswissgd::get_stac_assets(\n  collection_id = \"ch.swisstopo.swissimage-dop10\", \n  lon = 645685, \n  lat = 249287\n  )\n\n#\u003e # A tibble: 2 x 7\n#\u003e   type                             href  created updated eo:gs~1 proj:~2 check~3\n#\u003e   \u003cchr\u003e                            \u003cchr\u003e \u003cchr\u003e   \u003cchr\u003e     \u003cdbl\u003e   \u003cint\u003e \u003cchr\u003e  \n#\u003e 1 image/tiff; application=geotiff~ http~ 2021-0~ 2021-0~     0.1    2056 122088~\n#\u003e 2 image/tiff; application=geotiff~ http~ 2021-0~ 2021-0~     2      2056 122053~\n#\u003e # ... with abbreviated variable names 1: `eo:gsd`, 2: `proj:epsg`,\n#\u003e #   3: `checksum:multihash`\n```\n\n## `download_stac_assets`\nDownloads assets from the STAC API that were previously queried with a `get_stac_assets()` call.\n\n``` r\nres \u003c- swissgd::get_stac_assets(\n  collection_id = \"ch.swisstopo.swissimage-dop10\",\n  lon = 645685,\n  lat = 249287\n  )\n\nswissgd::download_stac_assets(res)\n```\n\n# Examples\n\n## Spatial distribution of place name suffixes\n### Setup\n**Idea**: Examine and visualise the spatial distribution of place name suffixes using spatial kernel density estimation.  \n**Datasets**: ch.swisstopo.swissnames3d, ch.swisstopo.swissboundaries3d-land-flaeche.fill  \n**Packages**: `sf`, `raster`, `btb`, `ggplot2` and friends  \n**Script**: [ex1_swissnames.R](https://github.com/zumbov2/swissgd/blob/main/examples/example1/ex1_swissnames.R)  \n\n### Some Results\n\u003cimg src=\"https://raw.githubusercontent.com/zumbov2/swissgd/main/examples/example1/ex1_1.png\" width=\"600\"\u003e  \n\u003cimg src=\"https://raw.githubusercontent.com/zumbov2/swissgd/main/examples/example1/ex1_2.png\" width=\"600\"\u003e  \n\u003cimg src=\"https://raw.githubusercontent.com/zumbov2/swissgd/main/examples/example1/ex1_3.png\" width=\"600\"\u003e  \n\n## Reachability by public transport\n### Setup\n**Goal**: Testing the newly available data via the STAC API.  \n**Datasets**: ch.are.erreichbarkeit-oev  \n**Packages**: `sf` and `ggplot2`  \n**Script**: [ex2.R](https://github.com/zumbov2/swissgd/blob/main/examples/example2/ex2.R)  \n\n### Results\n\u003cimg src=\"https://raw.githubusercontent.com/zumbov2/swissgd/main/examples/example2/ex2_map.png\" width=\"600\"\u003e   \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumbov2%2Fswissgd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzumbov2%2Fswissgd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzumbov2%2Fswissgd/lists"}