osm-flex


Nameosm-flex JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryPython package for flexible data extraction from OpenStreetMap
upload_time2023-11-21 14:22:11
maintainer
docs_urlNone
author
requires_python>=3.9
licenseGPL-3.0
keywords openstreetmap
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # osm-flex

<img align="right" width="200" alt="Logo" src="https://raw.githubusercontent.com/osm-flex/osm-flex/develop/doc/logo_osm-flex.png">

[![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/osm-flex/osm-flex)
[![github license badge](https://img.shields.io/github/license/osm-flex/osm-flex)](https://github.com/osm-flex/osm-flex)
[![PyPI version](https://badge.fury.io/py/osm-flex.svg)](https://badge.fury.io/py/osm-flex) 
[![PyPI - Downloads](https://img.shields.io/pypi/dm/osm-flex?color=yellow&label=Downloads)](https://pypistats.org/packages/osm-flex)
[![Documentation Status](https://readthedocs.org/projects/osm-flex/badge/?version=latest)](https://osm-flex.readthedocs.io/en/latest/?badge=latest)
[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8082963.svg)](https://doi.org/10.5281/zenodo.8082963)

Python package for flexible data extraction from OpenStreetMap. This packages allows to 

1. download OSM data dumps
2. [optional] clip to desired shape
2. extract specific features to geodataframes

## Documentation

Please refer to the [ReadTheDocs](https://osm-flex.readthedocs.io/en/latest/?badge=latest) of this project for the full documentation of all functions.

## Installation

```
conda create -n osm-flex cartopy geopandas
conda activate osm-flex
pip install osm-flex
```

---
NOTE

This package requires shapely v2.0 or later. Installing this package in an existing environment might overwrite older versions. 


The (optional) clipping functionalities require manual installation of osmconvert or osmosis. See tutorial 1 for details.

---

## Example
Download osm data for Switzerland from geofabrik.

```python
import osm_flex.download as dl

iso3 = 'CHE'
dl.get_country_geofabrik(iso3)
```

Extract all buildings related to education and extract all polygons with forests.

```python
import osm_flex.extract as ex
from osm_flex.config import OSM_DATA_DIR

path_che_dump = OSM_DATA_DIR.joinpath('switzerland-latest.osm.pbf')              
```

```python
gdf_ch_education = ex.extract_cis(path_che_dump, 'education')    
```
<img title="Education" alt="Education GeodataFrame" src="./doc/education_ch.png">


```python
gdf_ch_forest = ex.extract(
	path_che_dump, 'multipolygons', ['landuse', 'name'], "landuse='forest'"
	)    
```

<img title="Forests" alt="Forest map " src="./doc/forest_ch.png">


## Running Tests

Follow installation instructions. Then,
```
python -m pip install -e "./[tests]"
pytest
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "osm-flex",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Elco Koks <elco.koks@vu.nl>",
    "keywords": "OpenStreetMap",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/f7/e4/978565503d49f306808dada47e18e8f9ce12167762aee201c3f0f00a5fea/osm-flex-1.1.0.tar.gz",
    "platform": null,
    "description": "# osm-flex\n\n<img align=\"right\" width=\"200\" alt=\"Logo\" src=\"https://raw.githubusercontent.com/osm-flex/osm-flex/develop/doc/logo_osm-flex.png\">\n\n[![github repo badge](https://img.shields.io/badge/github-repo-000.svg?logo=github&labelColor=gray&color=blue)](https://github.com/osm-flex/osm-flex)\n[![github license badge](https://img.shields.io/github/license/osm-flex/osm-flex)](https://github.com/osm-flex/osm-flex)\n[![PyPI version](https://badge.fury.io/py/osm-flex.svg)](https://badge.fury.io/py/osm-flex) \n[![PyPI - Downloads](https://img.shields.io/pypi/dm/osm-flex?color=yellow&label=Downloads)](https://pypistats.org/packages/osm-flex)\n[![Documentation Status](https://readthedocs.org/projects/osm-flex/badge/?version=latest)](https://osm-flex.readthedocs.io/en/latest/?badge=latest)\n[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.8082963.svg)](https://doi.org/10.5281/zenodo.8082963)\n\nPython package for flexible data extraction from OpenStreetMap. This packages allows to \n\n1. download OSM data dumps\n2. [optional] clip to desired shape\n2. extract specific features to geodataframes\n\n## Documentation\n\nPlease refer to the [ReadTheDocs](https://osm-flex.readthedocs.io/en/latest/?badge=latest) of this project for the full documentation of all functions.\n\n## Installation\n\n```\nconda create -n osm-flex cartopy geopandas\nconda activate osm-flex\npip install osm-flex\n```\n\n---\nNOTE\n\nThis package requires shapely v2.0 or later. Installing this package in an existing environment might overwrite older versions. \n\n\nThe (optional) clipping functionalities require manual installation of osmconvert or osmosis. See tutorial 1 for details.\n\n---\n\n## Example\nDownload osm data for Switzerland from geofabrik.\n\n```python\nimport osm_flex.download as dl\n\niso3 = 'CHE'\ndl.get_country_geofabrik(iso3)\n```\n\nExtract all buildings related to education and extract all polygons with forests.\n\n```python\nimport osm_flex.extract as ex\nfrom osm_flex.config import OSM_DATA_DIR\n\npath_che_dump = OSM_DATA_DIR.joinpath('switzerland-latest.osm.pbf')              \n```\n\n```python\ngdf_ch_education = ex.extract_cis(path_che_dump, 'education')    \n```\n<img title=\"Education\" alt=\"Education GeodataFrame\" src=\"./doc/education_ch.png\">\n\n\n```python\ngdf_ch_forest = ex.extract(\n\tpath_che_dump, 'multipolygons', ['landuse', 'name'], \"landuse='forest'\"\n\t)    \n```\n\n<img title=\"Forests\" alt=\"Forest map \" src=\"./doc/forest_ch.png\">\n\n\n## Running Tests\n\nFollow installation instructions. Then,\n```\npython -m pip install -e \"./[tests]\"\npytest\n```\n",
    "bugtrack_url": null,
    "license": "GPL-3.0",
    "summary": "Python package for flexible data extraction from OpenStreetMap",
    "version": "1.1.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/ElcoK/osm-flex/issues",
        "Repository": "https://github.com/ElcoK/osm-flex"
    },
    "split_keywords": [
        "openstreetmap"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3fb47ec0f8b88a46535991905b256079178ef3426d0b4be0b5848bac41d63e96",
                "md5": "b07bbdbc6c2aa8a03115adccf55e84e5",
                "sha256": "c24a21a09298eb06a116cd018010a3d2f49d6d4ae2a12928b136e55f34da5866"
            },
            "downloads": -1,
            "filename": "osm_flex-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b07bbdbc6c2aa8a03115adccf55e84e5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 32483,
            "upload_time": "2023-11-21T14:22:10",
            "upload_time_iso_8601": "2023-11-21T14:22:10.561291Z",
            "url": "https://files.pythonhosted.org/packages/3f/b4/7ec0f8b88a46535991905b256079178ef3426d0b4be0b5848bac41d63e96/osm_flex-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f7e4978565503d49f306808dada47e18e8f9ce12167762aee201c3f0f00a5fea",
                "md5": "afac95f452b8b908bec077e4e512f79a",
                "sha256": "16875171aaeaba3b6f350051043c2d09957f45185eb655153494ec3d0d223d47"
            },
            "downloads": -1,
            "filename": "osm-flex-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "afac95f452b8b908bec077e4e512f79a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 33394,
            "upload_time": "2023-11-21T14:22:11",
            "upload_time_iso_8601": "2023-11-21T14:22:11.811932Z",
            "url": "https://files.pythonhosted.org/packages/f7/e4/978565503d49f306808dada47e18e8f9ce12167762aee201c3f0f00a5fea/osm-flex-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-21 14:22:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ElcoK",
    "github_project": "osm-flex",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "osm-flex"
}
        
Elapsed time: 0.14240s