Download vector data from OSM and store it to file


The application connects to Open Street Map server, downloads the data corresponding to the spatial extent of the support image, and filters the geometries based on OSM tags to produce a vector data file.

This application can be used to download reference data to perform the training of a machine learning model (see for instance [1]).

By default, the entire layer is downloaded. The application has a special mode to provide the list of available classes in the layers. The downloaded features are filtered by giving an OSM tag ‘key’. In addition, the user can also choose what ‘value’ this key should have. More information about the OSM project at [2].


Output vector data -out vectorfile Mandatory
Vector data file to store downloaded features

Support image -support image Mandatory
Image used to derive the spatial extent to be requested from OSM server (the bounding box of the extent is used). Be aware that a request with a large extent may be rejected by the server.

OSM tag key -key string
OSM tag key to extract (highway, building…). It defines a category to select features.

OSM tag value -value string
OSM tag value to extract (motorway, footway…). It defines the type of feature to select inside a category.

Elevation management

This group of parameters allows managing elevation values.

DEM directory -elev.dem directory
This parameter allows selecting a directory containing Digital Elevation Model files. Note that this directory should contain only DEM files. Unexpected behaviour might occurs if other images are found in this directory. Input DEM tiles should be in a raster format supported by GDAL.

Geoid File -elev.geoid filename [dtype]
Use a geoid grid to get the height above the ellipsoid in case there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles. A version of the geoid can be found on the OTB website (egm96.grd and egm96.grd.hdr at https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb/-/tree/master/Data/Input/DEM).

Default elevation -elev.default float Default value: 0
This parameter allows setting the default height above ellipsoid when there is no DEM available, no coverage for some points or pixels with no_data in the DEM tiles, and no geoid file has been set. This is also used by some application as an average elevation value.

Displays available key/value classes -printclasses bool Default value: false
Print the key/value classes available for the selected support image. If enabled, the OSM tag Key (-key) and the output (-out) become optional


From the command-line:

otbcli_OSMDownloader -support qb_RoadExtract.tif -key highway -out apTvUtOSMDownloader.shp

From Python:

import otbApplication

app = otbApplication.Registry.CreateApplication("OSMDownloader")

app.SetParameterString("support", "qb_RoadExtract.tif")
app.SetParameterString("key", "highway")
app.SetParameterString("out", "apTvUtOSMDownloader.shp")



This application requires an Internet access.