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
- Valid examples:
- if the
types
key is omitted, it defaults topoints
,lines
andpolygons
. - 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 theselect
ed keys are not null. - if
where
is a list, it is equivalent to eachwhere
child joined by OR.
Input formats:
- OSM PBF
- OSM XML
Output formats:
- OSM PBF
- OSM XML
- GeoPackage
- Shapefile
- KML
- OsmAnd
- Maps.ME
- Garmin
- 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.
- 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.
- 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.
-
Maps.ME
-
OsmAnd
-
Garmin
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file osm-export-tool-0.0.6.tar.gz
.
File metadata
- Download URL: osm-export-tool-0.0.6.tar.gz
- Upload date:
- Size: 15.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2e25f61a6317daf649c341bc78e2842b940220952decbceaf4d76506cf8322c |
|
MD5 | cdde6a713a4117c4ddb68083bb052226 |
|
BLAKE2b-256 | 922f70237bb2b073b798f6be7ef803ef42b1e20eaff95608d6e9206af4ccdefe |
File details
Details for the file osm_export_tool-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: osm_export_tool-0.0.6-py3-none-any.whl
- Upload date:
- Size: 20.8 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8f2bae356d301a20d9966f0b0435ae063219823dc910cf8c07d5308751ef761 |
|
MD5 | 46f7a059559bcd7389954c0f3cd9747d |
|
BLAKE2b-256 | 506663fac62bf141edf0325dd7dd013c2d2b78a9b68726be22647040b7369df5 |