Fork me on GitHub

ST_OSMDownloader

Signatures

ST_OSMDownloader(GEOMETRY geom, VARCHAR path);
ST_OSMDownloader(GEOMETRY geom, VARCHAR path, BOOLEAN delete);

Description

Download data from the OSM api using a bounding box (geom). The result is stored in an .osm file which the place and the name are defined in the path. If the delete parameter is equal to one (true), then the .osm file will be overwritten if it already exists.

Examples

Download OSM data:

CALL ST_OSMDownloader('POLYGON((-1.55 47.24, -1.55 47.25, 
                                -1.54 47.25, -1.54 47.24, 
                                -1.55 47.24))'::geometry, 
                      '/your_url/test.osm');

Read OSM file:

CALL OSMRead('/your_url/test.osm');

Note that the OSMRead function is described HERE.

Result:

On the left a screenshot from the OpenStreetMap website and on the right the result, with the building reconstruction (see OSMRead).

See also