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>
Metadata
Release files for osm-feature-extractor 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| osm_feature_extractor-0.3.0.tar.gz | 15.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| osm_feature_extractor-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.8 MB
Release files / osm_feature_extractor-0.3.0.tar.gz
| Download URL | osm_feature_extractor-0.3.0.tar.gz |
|---|---|
| Size | 15.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1930dda524a267df082bdd70b7f2945cef8e2b32565466a4cae89a3472a7ffe1
|
|
BLAKE2b-256 checksum How to use checksums |
7116bf3da849f79b9e5f180898a88212235c0bfba0ca6e0f5ba849949156a51f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|
Release files / osm_feature_extractor-0.3.0-py3-none-any.whl
| Download URL | osm_feature_extractor-0.3.0-py3-none-any.whl |
|---|---|
| Size | 15.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e656db41745788ef302ef085e477f7831ad87e9ffedc10e412479d22bc15212e
|
|
BLAKE2b-256 checksum How to use checksums |
4ebb74a3a1606004edc567b1fd581976ca0fa06ecb6830db982e353690dc1871
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.5
|