top of page

Tutorial: calculate the precise altitude of Place du Capitole (and any other point in France) using IGN's RGE Alti data and Python.


Calculating the precise altitude of a point may not be easy, but it's an essential step in anticipating certain effects of climate change, such as the risk of flooding.


In this new tutorial, we'll look at how to use IGN's altimetry data with Python. Our objective: to determine the altitude of the Place du Capitole in Toulouse.


Place du Capitole à Toulouse
The Place du Capitole in Toulouse

Access to Alti RGE data


IGN provides two versions of the RGE Alti dataset: RGE Alti 1 meter, with a horizontal resolution of 1 meter, and RGE Alti 5 meter, a resampled version with a resolution of 5 meters.


These data can be accessed via ftp. To download them, open FileZilla (or your preferred ftp client) and connect with :


  • Host: ftp3.ign.fr

  • User ID : RGE_ALTI_ext

  • Password: Thae5eerohsei8ve


FileZilla - connexion ftp3.ign.fr

In the bottom right-hand window, you'll see the files available for download. They are organized by department. As we're interested in Toulouse, we're going to download the data for Haute Garonne with a resolution of 5 meters, i.e. the file: RGEALTI_2-0_1M_ASC_LAMB93-IGN69_D031_2021-05-12.7z


Once the download is complete, unzip the file using 7-zip, for example.


The unzipped folder contains three subfolders:


  • 1_DONNEES_LIVRAISON: folder containing altitude data for each département, divided into “slabs”. Each slab is an .asc file, i.e. a type of text file.

  • 2_METADONNEES_LIVRAISON: metadata, publication date, contact, etc.

  • 3_SUPPLEMENTS_LIVRAISON: folder containing a shapefile describing the tiles.


Working environment


In this tutorial, we'll be manipulating two types of file: the shapefile describing the slabs and the .asc files containing the data for each slab.


As we've already done in other tutorials, we'll use geopandas to open the shapefile as a geodataframe. The data itself can be opened with Xarray, which again takes us back to familiar territory.


In addition to these two libraries, we'll also be using os to specify the path to the files, pyproj to switch easily from one coordinate system to another and shapely to manipulate geometric objects.


The first step is to create an environment with these libraries and import them:




Which slab does the point you're looking for belong to?


Let's take a closer look at the data contained in the 1_DONNEES_LIVRAISON folder: in total, the Haute Garonne is divided into 328 slabs measuring 5 by 5 kilometers.


To obtain the altitude of the point we're interested in, we first need to determine which slab it belongs to.


Fortunately, this data is accompanied in the 3_SUPPLEMENTS_LIVRAISON folder by a shapefile containing the geometry of each slab. Let's start by opening this file:



The metadata indicates that this file, like many French geographic data, uses a Lambert93 projection. This can be confirmed simply by displaying the geodataframe's crs (“coordinate reference system”), by typing gdf.crs.


If the only geographic coordinates you've ever heard of are latitude and longitude, you're using a geographic coordinate system known as WGS 84, of which there are hundreds. Including Lambert93.

But don't panic: we'll continue to work with conventional coordinates. We just need to create a transformer to convert from WGS 84 to Lambert93. Thanks to pyproj, it's easier to do than to explain:



Now all that remains is to find the latitude and longitude of the Place du Capitole and use the transformer to convert them into Lambert93 :



We have the coordinates of the point we're looking for in the geodataframe coordinate system. To find the slab of interest, we need to select the geodataframe line whose geometry contains our point.


To do this, we'll create a geometric object from our coordinates and then use .contains to filter the geodataframe:



Only the 235th line of the geodataframe contains our point. It gives us the name of the slab we're interested in: RGEALTI_FXX_0570_6280_MNT_LAMB93_IGN69.



Use of RGE Alti elevation data


Now that we know which tile contains the point whose altitude we're looking for, we can open it with Xarray. We'll take this opportunity to display the data and see what it looks like:



The result is as follows:


visualisation d’une dalle RGE Alti - Toulouse - La Garonne apparait clairement avec l’Île du Ramier au centre. La colline de Pech-David est aussi facilement identifiable en bas à droite.

The visualization of the RGE Alti slab shows the local relief. We've made no mistake: this is Toulouse. The Garonne River is clerly visible, with the île du Ramier in the center. The Pech-David hill is also easily identifiable in the lower right.

All that remains is to find the pixel value corresponding to our search:



And there you have it: according to IGN's RGE Alti data, the altitude at the center of Place du Capitole is 142.8 meters.



 

About: Callendar is a start-up specializing in the development of innovative solutions for climate risk assessment. Aware of the challenge of adapting to climate change, we strive to share our expertise through accessible tools and tutorials like this one.



bottom of page