OSMDownloader

Download vector data from OSM and store it to file

Description

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].

This application has several output images and supports “multi-writing”. Instead of computing and writing each image independently, the streamed image blocks are written in a synchronous way for each output. The output images will be computed strip by strip, using the available RAM to compute the strip size, and a user defined streaming mode can be specified using the streaming extended filenames (type, mode and value). Note that multi-writing can be disabled using the multi-write extended filename option: &multiwrite=false, in this case the output images will be written one by one. Note that multi-writing is not supported for MPI writers.

Parameters

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. Supported formats are SRTM, DTED or any geotiff. DownloadSRTMTiles application could be a useful tool to list/download tiles related to a product.

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.

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(https://gitlab.orfeo-toolbox.org/orfeotoolbox/otb-data/blob/master/Input/DEM/egm96.grd).

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

Examples

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")

app.ExecuteAndWriteOutput()

Limitations

This application requires an Internet access.