Read elevation from Swisstopo api
Bas den Brok - mapping course



Understanding of python, some understanding of Dutch and at the end only a little understanding of QGIS required.


We want to read the elevation for given points in Swissgrid CH1903 coordinates from the Swisstopo api. To read the elevation of one point, in this case the point with Swissgrid coordinates 721963.74, 230896.23 the python may look like below:


The elevation of this point appears to be 667.6 m. The output on the screen looks like:


To read the elevations of a file of coordinates the python code may look like here below. Thsi si the file: readaltitudes2a.py (not for use! Only to help you write your own program.)


And the output on the screen like this:


A text file is created with outcrop number, SVG-GUI coordinates, Swissgrid coordinates and the elevation (in meter) as shown below:


We import this text file with the elevations into QGIS prject with the appropriate georeferenced Swiss topographic map as shown below. In the lower right corner you can see that the coordinate reference frame (CRS) is EPSG:21781 i.e. CH1903/LV03


Now add delimited text layer (symbol with the big comma) and the below pop up window appear. Select the text file with the coordinates of the outcrops. Space and comma should be selected as delimeters. As x-field chose field_4, as y-field chose field_5, as Z field chose the elevations of field_6 and as M field the outcrop numbers of field_1 and add.


The result may loo like here below. You know yourself how to improve the lay out.