earth-osm

Export infrastructure data from OpenStreetMap using Python

https://github.com/pypsa-meets-earth/earth-osm

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    2 of 7 committers (28.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.9%) to scientific vocabulary

Keywords

earth-osm open-data openstreetmap power pypsa

Keywords from Contributors

energy-system-model energy-system scenario-analysis pypsa-earth pypsa-africa power-system-planning power-system-model operational-optimization investment-optimization energy-system-planning
Last synced: 6 months ago · JSON representation

Repository

Export infrastructure data from OpenStreetMap using Python

Basic Info
Statistics
  • Stars: 36
  • Watchers: 2
  • Forks: 15
  • Open Issues: 6
  • Releases: 16
Topics
earth-osm open-data openstreetmap power pypsa
Created over 3 years ago · Last pushed about 1 year ago
Metadata Files
Readme Changelog Contributing License

README.md

# earth-osm One-command to extract infrastructure data from OpenStreetMap [![][badge-pypi-monthly-downloads]][pypi-url] [![][badge-codecov]][codecov-url] [![][badge-ci]][gh-repo-url] [![][badge-docs]][docs-url] [![][badge-pypi]][pypi-url] [![][badge-conda]][conda-url] [![][badge-release]][gh-release-url] [![][badge-license]][license] [![][badge-discord]][discord-url] [![][badge-gh-stars]][gh-stars-url] [![][badge-gh-forks]][gh-forks-url] [![][badge-gh-issues]][gh-issues-url] [![][badge-gh-pulls]][gh-pulls-url]

📚 Overview

earth-osm downloads, filters, cleans and exports infrastructure data from OpenStreetMap (OSM). It provides a Python API and a CLI interface to extract data for various infrastructure types, such as power lines, substations, and more.

🌟 Key Features

  • 🔌 Extracts infrastructure data from OSM
  • 🧹 Cleans and standardizes the data (coming soon)
  • 🚀 No API rate limits (data served from GeoFabrik)
  • 🐍 Provides a Python API
  • 🖥️ Supports multiprocessing for faster extraction
  • 📊 Outputs data in .csv and .geojson formats
  • 🌍 Supports global data extraction
  • 🖱️ Easy-to-use CLI interface

🚀 Getting Started

Installation

Install earth-osm using pip (recommended):

bash pip install earth-osm

Or with conda:

bash conda install --channel=conda-forge earth-osm

Basic Usage

Extract OSM data using the CLI:

bash earth_osm extract power --regions benin monaco --features substation line

This command extracts power infrastructure data for Benin and Monaco, focusing on substations and power lines. By default, the resulting .csv and .geojson files are stored in ./earth_data/out.

Load the extracted data using pandas:

```python import pandas as pd import geopandas as gpd

For Pandas

dfsubstations = pd.readcsv('./earthdata/out/BJraw_substations.csv')

For GeoPandas

gdfsubstations = gpd.readfile('./earthdata/out/BJraw_substations.geojson') ```

🛠️ CLI Reference

Extract Command

bash earth_osm extract <primary> --regions <region1> <region2> ... [options]

Arguments:

  • <primary>: Primary feature to extract (e.g power)

Required Options:

  • --regions: Specify one or more regions using ISO 3166-1 alpha-2, ISO 3166-2 codes, or full names

Tip: A list of regions is available at regions.md

Optional Arguments:

| Argument | Description | Default | |----------|-------------|---------| | --features | Specify sub-features of the primary feature | All features | | --update | Update existing data | False | | --no_mp | Disable multiprocessing | False (MP enabled) | | --data_dir | Path to data directory | './earthdata' | | `--outdir| Path to output directory | Same as data_dir | |--outformat| Export format(s): csv and/or geojson | ['csv', 'geojson'] | |--aggfeature| Aggregate outputs by feature | False | |--agg_region` | Aggregate outputs by region | False |

🐍 Python API

For more advanced usage, you can use the Python API:

```python import earth_osm as eo

eo.saveosmdata( primaryname='power', regionlist=['benin', 'monaco'], featurelist=['substation', 'line'], update=False, mp=True, datadir='./earthdata', outformat=['csv', 'geojson'], out_aggregate=False, ) ```

🛠️ Development

To contribute to earth-osm, follow these steps:

  1. (Optional) Install a specific version of earth_osm: bash pip install git+https://github.com/pypsa-meets-earth/earth-osm.git@<required-commit-hash>

  2. (Optional) Create a virtual environment for Python >=3.10: bash python3 -m venv .venv source .venv/bin/activate

  3. Install the development dependencies: bash pip install git+https://github.com/pypsa-meets-earth/earth-osm.git pip install -e .[dev]

  4. Read the CONTRIBUTING.md file for more detailed information on how to contribute to the project.

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

🤝 Community

Join our Discord community to connect with other users and contributors, ask questions, and get support.

📚 Documentation

For more detailed information, check out our full documentation.


Made with ❤️ by the PyPSA meets Earth team

earth-osm logo

Owner

  • Name: PyPSA meets Earth
  • Login: pypsa-meets-earth
  • Kind: organization

An open source energy system model initiative for our Earth

GitHub Events

Total
  • Create event: 9
  • Commit comment event: 1
  • Release event: 9
  • Issues event: 5
  • Watch event: 7
  • Delete event: 6
  • Issue comment event: 23
  • Push event: 23
  • Pull request review event: 1
  • Pull request event: 6
  • Fork event: 5
Last Year
  • Create event: 9
  • Commit comment event: 1
  • Release event: 9
  • Issues event: 5
  • Watch event: 7
  • Delete event: 6
  • Issue comment event: 23
  • Push event: 23
  • Pull request review event: 1
  • Pull request event: 6
  • Fork event: 5

Committers

Last synced: 6 months ago

All Time
  • Total Commits: 260
  • Total Committers: 7
  • Avg Commits per committer: 37.143
  • Development Distribution Score (DDS): 0.469
Past Year
  • Commits: 15
  • Committers: 3
  • Avg Commits per committer: 5.0
  • Development Distribution Score (DDS): 0.4
Top Committers
Name Email Commits
mnm-matin m****9@g****m 138
Matin Mahmood m****d@e****k 54
Max Parzen m****n@e****k 30
Davide Fioriti f****s@g****m 17
Matin Mahmood 4****n@u****m 15
Davide Fioriti 6****f@u****m 5
Fabian Hofmann f****f@g****e 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 40
  • Total pull requests: 20
  • Average time to close issues: 3 months
  • Average time to close pull requests: 5 days
  • Total issue authors: 14
  • Total pull request authors: 5
  • Average comments per issue: 1.7
  • Average comments per pull request: 1.45
  • Merged pull requests: 18
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 4
  • Pull requests: 3
  • Average time to close issues: 25 days
  • Average time to close pull requests: 5 days
  • Issue authors: 4
  • Pull request authors: 1
  • Average comments per issue: 0.5
  • Average comments per pull request: 3.0
  • Merged pull requests: 3
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • pz-max (15)
  • davide-f (7)
  • mnm-matin (5)
  • DeniseGiub (2)
  • zoobar (1)
  • dziegler991 (1)
  • ekatef (1)
  • bobbyxng (1)
  • FabianHofmann (1)
  • simulkade (1)
  • Wuhochi (1)
  • jome1 (1)
  • LRydin (1)
  • FlorianK13 (1)
Pull Request Authors
  • davide-f (10)
  • pz-max (8)
  • mnm-matin (5)
  • FabianHofmann (2)
  • simulkade (1)
Top Labels
Issue Labels
enhancement (21) question (21) bug (14) help wanted (14)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 318 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 16
  • Total maintainers: 3
pypi.org: earth-osm

Python tool to extract large-amounts of OpenStreetMap data

  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 318 Last month
Rankings
Dependent packages count: 6.6%
Downloads: 12.3%
Forks count: 13.6%
Average: 16.5%
Stargazers count: 19.5%
Dependent repos count: 30.6%
Maintainers (3)
Last synced: 6 months ago

Dependencies

requirements-test.txt pypi
  • black * test
  • codecov * test
  • coverage * test
  • flake8 * test
  • gitchangelog * test
  • isort * test
  • mkdocs * test
  • mypy * test
  • pytest * test
  • pytest-cov * test
requirements.txt pypi
  • geopandas *
  • pandas *
  • protobuf *
  • requests *
  • tqdm *
.github/workflows/main.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v3 composite
.github/workflows/release.yml actions
  • actions/checkout v2 composite
  • actions/checkout v1 composite
  • actions/setup-python v1 composite
  • softprops/action-gh-release v1 composite
setup.py pypi
  • geopandas *
  • pandas *
  • protobuf >=4.21.1
  • requests *
  • tqdm *