OpenStreetMap GeoJSON Exporter
Project description
osmexp - OpenStreetMap GeoJSON Exporter
The OSM API uses a specific format for their geometric primitive types based on nodes, ways and relations; and those unfortunately don’t translate 1:1 with GeoJSON types, thus a conversion is needed,
Installation:
Make sure have at least Python 3.11, and install it with:
$ pip install osmexp
The only requirements are Requests and Shapely.
Usage
For all exports, this is the format:
$ osmexp [element_type] [element_id]
Where element_type can be node, way or rel (for "relation"). And the ID is the numerical identifier used by OSM, if you don’t know how to get the OSM ID, follow this article.
The output is set to STDOUT, and it is recommended to be piped into a file or another command.
Exporting Nodes:
$ osmexp node 9589344640 > outdoor_seating.geojson
This returns a GeoJSON with a Point as a root type.
Exporting Ways:
$ osmexp way 398987317 > canal_grande.geojson
This returns a GeoJSON with a LineString as a root type if the the line is “open” or Polygon if the line is “closed”.
Exporting Relations:
$ osmexp rel 4817103 > venice.geojson
This returns a GeoJSON with a FeatureCollection as a root, and the internal features as LineString or Polygon, depending if they can self-close, or fail the polygon transformation by other means (self crossing, etc).
License
This library is released under the 3-Clause BSD License.
tl;dr: "free to use as long as you credit me".
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 Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file osmexp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: osmexp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d88244b5464d922f76d21567e6786882f564842cdfc30357c92f95c2b1cd51c0
|
|
| MD5 |
360d6e4a995916ef40d905eda7d0e4ac
|
|
| BLAKE2b-256 |
3c5e0d70699c8ea288b50bafebe5a09f4a5aa310da29fef6c718aca216a5cef5
|