Coder Social home page Coder Social logo

osm-flex

Logo

github repo badge github license badge PyPI version PyPI - Downloads Documentation Status fair-software.eu DOI

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

  1. download OSM data dumps
  2. [optional] clip to desired shape
  3. extract specific features to geodataframes
  4. [optional] simplify results based on geospatial operations

Documentation

Please refer to the ReadTheDocs 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.

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.

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')              
gdf_ch_education = ex.extract_cis(path_che_dump, 'education')    

Education GeodataFrame

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

Forest map

Drop all education building units that are contained within larger education buildings.

import osm_flex.simplify as sy
gdf_ch_education = sy.rremove_contained_polys(gdf_ch_education)

Running Tests

Follow installation instructions. Then,

python -m pip install -e "./[tests]"
pytest

osm-flex's Projects

osm-flex icon osm-flex

Python package for flexible data extraction from OpenStreetMap

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.