Skip to content

Docker container for OSM tools (OSMConvert, OSMFilter, OSMUpdate, Osmosis, Gdal/Ogr)

License

Notifications You must be signed in to change notification settings

Aegman/osm-tools-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

OSM Tools

Command line tools to work with OSM files in docker.

This image contains the following comand line utilities:

  • osmctools - Includes osmconvert, osmfilter & osmupdate tools.
  • osmosis - Command line tools to extract specific tags to OSM files.
  • GDAL/OGR - convert OSM to other formats.

Prepare your data:

Download some OSM data (pbf) from Geofabrik, or other sources.

for example:

wget https://download.geofabrik.de/south-america/peru-latest.osm.pbf -O $env:USERPROFILE/downloads/data/osm/peru.osm.pbf

Mount your data folder to the osm volume when running the container: --volume /downloads/data/osm:/osm

Using this image

Build image with:

docker build -t osm-tools:latest .

To run as an interactive command line:

docker run --rm  -it --volume  $env:USERPROFILE/downloads/data/osm:/osm osm-tools /bin/bash

Examples

Convert from osm.pbf to o5m

docker run --rm  -it --volume $env:USERPROFILE/downloads/data/osm:/osm osm-tools osmconvert peru.osm.pbf -o=peru.o5m

Extract all highways

docker run --rm -it --volume $env:USERPROFILE/downloads/data/osm:/osm osm-tools osmfilter peru.o5m --keep="highway=" -o=highways.osm

OR

docker run --rm -it --volume $env:USERPROFILE/downloads/data/osm:/osm osm-tools osmosis --read-pbf peru.osm.pbf --tf accept-ways highway=* --used-node --write-xml highways.osm

Convert OSM to SHP

docker run --rm -it --volume $env:USERPROFILE/downloads/data/osm:/osm osm-tools ogr2ogr -skipfailures -f GPKG highways.gpkg highways.osm lines