Library to extract OSM features and map them to GeoJSON polygons.
Project description
OSM Feature Extractor
Introduction
Lightweight application to automatically extract features from an OSM file, and map them to
user defined GeoJSON polygon(s). The mapped features can then be potentially used for machine learning applications based
on OSM data. The extracted features can be a count
for nodes, a length
for ways and area
for areas.
For more details on the features that are extracted, check FEATURES.md and the OSM wiki.
Example generated dataframe:
Data visualised on a map:
Usage
After cloning the project into your local machine, you'll need to create a virtual environment with
the required packages. This can be achieved easily with Poetry, as it
will make sure all the versions are correct, but alternatively it can be installed by other means
with the requirements.txt
file provided. At the root directory of the project run:
$ poetry install
$ poetry shell
When all the packages have been installed and the virtual env is activated, you can then run the script that will map the features:
$ python osm_feature_extractor/main.py
The above command will run on an included OSM file isle-of-wight-latest.osm.pbf
and isle-of-wight.geojson
.
You can go to configuration file in order to adjust the app configuration parameters. The main ones are detailed below:
osm_file: Name of osm file whose features will be extracted. To download more files visit the
geofabrik website.
input_polygons_file: Name of file containing the GeoJSON polygon(s) for which the OSM features will be mapped against.
output_file: Path to the output file where the mapped OSM features are written to.
Note: Large files might take a while to process. It is recommended to use the CLI osmium extract tool in order to reduce the OSM file to the area of interest first and then run the feature extractor.
`
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
Hashes for osm_feature_extractor-0.1.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fd7f85d557223ab2fc355f362e28c674c6567280bdf2862d8e7e45f9b1b235c |
|
MD5 | e32b42e374af99b6112e93840b9f22c5 |
|
BLAKE2b-256 | 036bc44744e38d40f25fc7c3115de7d7b4e3f09998ee94d2019178682d227931 |
Hashes for osm_feature_extractor-0.1.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89704f9afcb08c27ec3f713bd2d00a36d4bc83215a2a77ee47f1a35b9f2c8268 |
|
MD5 | 46002574d8b151845f4dea59b6bcab43 |
|
BLAKE2b-256 | be373ff60fb03ff9378ffb1d7c1bd14eb6e96a7b22fe8798ef3e3faef04d9343 |