Skip to main content

Convert OpenStreetMap data into GIS and mobile mapping file formats.

Project description

OSM Export Tool

This project is under development. For the previous version of the Export Tool, see hotosm/osm-export-tool.

Motivation

This program filters and transforms OpenStreetMap data into thematic, tabular GIS formats. Filters are specified via YAML and a familiar SQL syntax, for example:

buildings_with_addresses:  # creates a thematic layer called "buildings_with_addresses"
  types:
    - polygons
  select:
    - building
    - height
    - addr:housenumber
  where:
    - building = 'yes' and addr:housenumber IS NOT NULL

This program uses PyOsmium to read OSM files and GDAL/OGR to write GIS formats, so it should be reasonably fast and light on memory. There is also a OSM driver available for GDAL/OGR, but this program is intended to allow for more flexibility in the conversion process. it can also create files in non-tabular formats such as those for Garmin GPS devices or the OSMAnd Android app.

Example usage

osm-export-tool jakarta.osm.pbf jakarta

All the below flags are optional.

  • -m, --mapping : specify a mapping YAML. Defaults to example/defaults.yaml, which is a very broad selection of OSM tags.
  • -f, --formats : a comma-separated list of formats such as gpkg, shp. Defaults to just gpkg.
  • --omit-osm-ids: An osm_id field is included in each layer by default, which is a node ID for points, and a way id (positive) or relation id (negative) for lines and polygons. This will prevent this field being added by default, although it may still be specified in select.
  • --clip : either a .poly or GeoJSON file.

Yaml format

  • SQL statements must be comparisons of keys to constants with the key first.
    • Valid examples:
      • height > 20
      • building = 'yes'
    • Invalid examples:
      • 20 < height
      • building > height
  • if the types key is omitted, it defaults to points, lines and polygons.
  • At least one tag is required as a child of the select key.
  • If the where key is omitted, it defaults to the condition where any of the selected keys are not null.
  • if where is a list, it is equivalent to each where child joined by OR.

Input formats:

  • OSM PBF
  • OSM XML

Output formats:

  • OSM PBF
  • OSM XML
  • GeoPackage
  • Shapefile
  • KML
  • OsmAnd
  • Maps.ME
  • Garmin
  1. OGC GeoPackage (.gpkg)
  • This is the default export format, and the most flexible for modern GIS applications.
  • tables will be created with the wkbUnknown geometry type, which allows heterogeneous geometry types.
  1. Shapefile (.shp)
  • Each layer and geometry type is a separate .SHP file. This is because each .SHP file only supports a single geometry type and column schema.
  1. KML (.kml)
  • Each layer and geometry type is a separate .KML file. This is because the GDAL/OGR KML driver does not support interleaved writing of features with different geometry types.
  1. Maps.ME

  2. OsmAnd

  3. Garmin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

osm-export-tool-0.0.3.tar.gz (11.6 kB view details)

Uploaded Source

Built Distributions

osm_export_tool-0.0.3-py3.7.egg (36.9 kB view details)

Uploaded Source

osm_export_tool-0.0.3-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file osm-export-tool-0.0.3.tar.gz.

File metadata

  • Download URL: osm-export-tool-0.0.3.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for osm-export-tool-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f1ec1fd3b02550ffe7a3989a1225f0619f74b1bd85898cb9c10b5b5dc3d07528
MD5 83fc466eb834ae17947ab413838145fa
BLAKE2b-256 3c597caf13ff8e548641138d73afe7282edced5203c6cae646e9f5ecf5d6666b

See more details on using hashes here.

File details

Details for the file osm_export_tool-0.0.3-py3.7.egg.

File metadata

  • Download URL: osm_export_tool-0.0.3-py3.7.egg
  • Upload date:
  • Size: 36.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for osm_export_tool-0.0.3-py3.7.egg
Algorithm Hash digest
SHA256 46862daa0b3ddb80e17abda8aba4ee48f1b422512b8457d8690b282dc88c68f0
MD5 31b0b72a35bbc09c87e44f84956b404b
BLAKE2b-256 d9279787806ab203e86b15ef09513a85c637ffcee40125c64688bea0eb0f0fdf

See more details on using hashes here.

File details

Details for the file osm_export_tool-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: osm_export_tool-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 17.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for osm_export_tool-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b5905b7addd708892ca19946e5bd1d247ac55cec479a4727ec093ab9870f27bc
MD5 395aa15b45d83fef6a527c5af9f81695
BLAKE2b-256 9a10672a986181c42fae79d5edc196c04b9247c2e46939d04a4df38bfd06b8e0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page