Montpellier, France/Buildings Heights Import

From OpenStreetMap Wiki
Jump to navigation Jump to search


The goal of that import is to update existing OSM buildings of Montpellier with height information (see Key:height tag).


Almost all buildings of Montpellier are already into OSM (thanks to the data import of the French land registry) but there is no height data and so no realistic 3D view of the city of Montpellier is possible.

Luckily enough, the city of Montpellier has an OpenData website where Digital Elevation Models (DEMs) are available under the ODbL licence:

  • Digital Terrain Model (DTM) or Modèle Numérique de Terrain (MNT) in french: it contains the elevation of the ground (ie. excluding vegetation and buildings).
  • Digital Surface Model (DSM) or Modèle Numérique de Surface (MNS) in french: it contains the elevation of the surface (ie. including vegetation and buildings).

With these 2 datasets, it is possible to calculate a maximum height of each building already present in OSM.


The import should be launched only once in October 2017.

Import Data


Data source site: Open Data de Montpellier Mediterranée Métropole (
Data license: ODbL

OSM Data Files

There's no prepared files since the import program updates directly buildings into the OSM database via the OSM API.

Import Type

The import is designed to be launched one-time (although it can be relaunched many times).

All the process is automatic and done in one shout.

Data Preparation

Data Reduction & Simplification

There's no special reduction or simplification since the imported data are elevation ("Z") values from DEM files (DSM + DTM).

For the DTM the files are provided into the DXF format. To be usable by my scripts they are been merged into an unique file and then converted into a GeoTiff file (thanks to ogr2ogr and gdal_wrap). Note also that the DTM has been cropped with administrative boundaries of the municipality of Montpellier because values outside them are not reliable.

Tagging Plans

On each created changeset there are 2 tags:

  • source: Open Data de Montpellier Mediterranée Métropole (
  • comment: Automatic import of buildings heights in Montpellier, France.

Changeset Tags

Every 1000 updated buildings a new changeset is created with the tags described above.

Data Transformation

The only data transformation is to add a new building:height tag to the way-building, nothing more.

Data Merge Workflow

There's no merge workflow because data are directly imported via the OSM API.

But note that the import is not aggressive: it updates a building only if the relative way element has no building:height tag already present. That way it cannot disturb works of other contributors.

Team Approach

I'm doing it solo for now but any help or suggestions are welcome.

The software itself is available on GitHub :

The import has been discussed on french forum and on the talk-fr mailing list.


Well there's no really workflow since the import process is fully automatic. The only thing to do is to the launch the main class :)


As described above there's no big risk of conflation since the program doesn't touch buildings which have already a building:height tag.


A lot of manual checks has been performed on hundreds of buildings.

Theses checks was based on the Google Earth because the area of Montpellier is covered by the photogrammetry technology of Google so it's very easy to see elevation of buildings and compare them with the elevation of the ground.

At the end I can say that the accuracy is very good, about ~1 meter.


The imports into the live database was done on 2017-11-04 and the settings were like that:

  • Minimum matching score is: 0.3
  • Shrink radius is: 1.0
  • Minimum matching point is: 2
  • Computing distance is: 20
  • Tolerance delta is: 0.5

Here are the results:

  • Total of targeted elements (ie. which are inside filtering areas): 110180
  • Total of matched elements (ie. which have at least one matching imports): 95914
  • Total of matching imports: 42547442
  • Average of matching imports by element: 443
  • Out of range DTM values: 33888
  • Out of range DSM values: 0
  • Total of read operations: success=60802 failure=29
  • Total of write operations: success=60777 failure=2
  • Total of updatable elements: 60831
  • Total of changeset operations: open=61 close=61

=> 60 777 buildings has been updated.


On certain areas that are on the outskirts of the municipality, the calculated heights are wrong because the DTM provides data at 0 whereas they should be at -9999 (and therefore be excluded). I will obviously correct all this, a priori manually with JOSM.

Edit: finally the problem was concerning too much buildings (5172) so it was fixed programmatically.

Conclusion: the imports has updated 60 777 - 5 172 = 55 605 buildings with their height value.