Library to extract OSM features and map them to GeoJSON polygons.
Project description
OSM Feature Extractor
A lightweight application designed to automatically extract features from an OpenStreetMap (OSM)
file and map them to a user-defined GeoJSON file containing a collection of polygons.
The extracted features can include count for nodes, length for ways, and area for areas.
These features can then be used for machine learning applications based on OSM data.
For more details on the features that are extracted, check FEATURES.md and the OSM wiki.
Example generated dataframe:
Data visualised on a map:
Installation
$ pip install osm-feature-extractor
Usage
After installation, you can use the tool directly with the osm_feature_extractor command,
which supports two primary operations: extract and analyze.
extract
The extract command requires a minimum of three flags:
$ osm_feature_extractor extract \
--osm-file <path_to_osm_file> \
--input-polygons-file <path_to_polygons_file> \
--output-file <path_to_output_file>
To see all available flags, use the help command:
$ osm_feature_extractor extract --help
Alternatively, you can provide a .conf file with the required parameters:
$ osm_feature_extractor extract --conf-file <path_to_conf_file>
The configuration file should have the following format:
[user-defined]
osm_file: <path_to_osm_file>
input_polygons_file: <path_to_polygons_file>
output_file: <path_to_output_file>
[default]
process_base_data: True
process_osm_data: True
polygons_file: polygons.geojson
osm_extractor_files_dir: osm_extractor_files_dir
Note: Processing large OSM files may take some time. It is recommended to use the CLI tool osmium extract to reduce the OSM file to your area of interest before running the feature extractor.
analyze
The analyze command provides a quick overview of the OSM file, including the total number of nodes,
ways, bounds, and the centroid. To use this feature, run:
$ osm_feature_extractor analyze --osm-file <path_to_osm_file>
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
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 osm_feature_extractor-0.3.0.tar.gz.
File metadata
- Download URL: osm_feature_extractor-0.3.0.tar.gz
- Upload date:
- Size: 15.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1930dda524a267df082bdd70b7f2945cef8e2b32565466a4cae89a3472a7ffe1
|
|
| MD5 |
b2cfa6a675c8ed079459d22b338e3332
|
|
| BLAKE2b-256 |
7116bf3da849f79b9e5f180898a88212235c0bfba0ca6e0f5ba849949156a51f
|
File details
Details for the file osm_feature_extractor-0.3.0-py3-none-any.whl.
File metadata
- Download URL: osm_feature_extractor-0.3.0-py3-none-any.whl
- Upload date:
- Size: 15.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e656db41745788ef302ef085e477f7831ad87e9ffedc10e412479d22bc15212e
|
|
| MD5 |
9c0693fe89a3a4daee1687bfca4475ad
|
|
| BLAKE2b-256 |
4ebb74a3a1606004edc567b1fd581976ca0fa06ecb6830db982e353690dc1871
|