3

I am looking for elevation data for Swiss municipalities (Gemeinden). I'd like something simple that can be joined to other data sources, for example, as a CSV,

postal_code    municipality_name    elevation_meters
8000    Zürich    408

(to make it simple, elevation can be median or average over the entire surface, or just the elevation as a central point).

If the data isn't available, then some steps to generate the dataset from open data would be an acceptable answer.


OpenElevation project would work, but it involves passing individual latitude/longitude pairs, and the current API (github) seems to have spotty service. Another option is Google's Elevation API, but that would also require individual requests.

The official regional portrait doesn't have elevation, nor does it have the latitude/longitude that I could use to look up each municipality.

Official maps has municipality shape files and elevation, but I don't see any data download option.


License: for a hobby project, so most licenses will work

2

3 Answers 3

1

Elevation data is included in the „Generalisierte Gemeindegrenzen“ by the Swiss Federal statistical Office. See here: https://www.bfs.admin.ch/bfs/de/home/dienstleistungen/geostat/geodaten-bundesstatistik/administrative-grenzen/generalisierte-gemeindegrenzen.html

A direct link to the Excel file: https://www.bfs.admin.ch/bfs/de/home/dienstleistungen/geostat/geodaten-bundesstatistik/administrative-grenzen/generalisierte-gemeindegrenzen.assetdetail.7566562.html

enter image description here

and the sheet named g1g19 has the Z min, max, center, median and average.

3

Here is a possible SPARQL query for Wikidata:

# swiss municipalities with their elevation
SELECT ?muni ?muniLabel (MIN(?elevation) as ?minElevation)
WHERE 
{
  ?muni wdt:P31 wd:Q70208.
  FILTER NOT EXISTS { ?muni wdt:P31 wd:Q685309 }
  OPTIONAL {
    ?muni wdt:P2044 ?elevation.
    ?muni p:P2044 ?statement.
    ?statement wikibase:rank ?rank.
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?muni ?muniLabel
ORDER BY ?muniLabel

Note that the elevation is added optionally, so you could get empty values there.

2
  • Thanks for this @odi. Could you help modify the query to give the minimum elevation per municipality, thus remove duplicates?
    – philshem
    Jan 9, 2020 at 8:11
  • 1
    yes sure, just updated my answer 😉
    – Odi
    Jan 10, 2020 at 9:50
2

This information can be produced from open data in GIS software. Here are the basic steps using QGIS, which is free GIS software. You can do the same thing in any GIS, but the specific tool names will be different.

  1. Download a DEM raster (digital elevation model) for Switzerland, eg from https://www.opendem.info/opendemeu_download_4326.html
  2. Download the municipality boundaries as a geospatial layer, eg from https://gadm.org/download_country_v3.html
  3. If the DEM raster data is split over multiple raster tiles, combine them into a single raster (every GIS software has a tutorial for this; here's a tutorial in QGIS).
  4. Calculate elevation in the municipalities:

    • Use the Zonal Statistics tool (or the equivalent in your GIS software) to calculate the mean, median and/or mode of elevation within each municipality.
    • Or, to calculate the elevation only at a point within each municipality, use the Point on Surface tool to find a point roughly at the middle of each municipality, then use the Sample Raster Values tool to find the elevation value for each point.
  5. Export the result from step 4 to a CSV file. Now you have a table where each municipality is a separate line, and the columns include

    • elevation (mean/median/mode or at a single point, depending on which options you chose in step 4
    • municipality name
    • any other information that came with the municipality source data downloaded in step 2

Postal codes will probably not be included; you will probably need to join these from another source.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.