Skip to main content

Low-level Python library to interact with OSM PBF files

Project description

esy.osm.pbf is a low-level Python library to interact with OpenStreetMap data files in the Protocol Buffers (PBF) format.

Usage

To count the amount of parks in the OpenStreetMap Andorra .pbf file (at least according to a copy from geofabrik), do this:

First download a copy of the andorra dataset:

>>> import os, urllib.request
>>> if not os.path.exists('andorra.osm.pbf'):
...     filename, headers = urllib.request.urlretrieve(
...         'https://download.geofabrik.de/europe/andorra-190101.osm.pbf',
...         filename='andorra.osm.pbf'
...     )

Open the file and iterate over all entry and count those with a tag leisure having a value of park.

>>> import esy.osm.pbf
>>> osm = esy.osm.pbf.File('andorra.osm.pbf')
>>> len([entry for entry in osm if entry.tags.get('leisure') == 'park'])
21

Design, Development & Contributing

Design and development notes are available in esy.osm.pbf.test.

We would be happy to accept contributions via merge requests, but due to corporate policy we can only accept contributions if you have send us the signed contributor license agreement.

Contact

Please use the projects issue tracker to get in touch.

Team

esy.osm.pbf is developed by the DLR Institute of Networked Energy Systems in the departement for Energy Systems Analysis (ESY).

Acknowledgements

The authors would like to thank the Federal Government and the Heads of Government of the Länder, as well as the Joint Science Conference (GWK), for their funding and support within the framework of the NFDI4Ing consortium. Funded by the German Research Foundation (DFG) - project number 442146713.

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

esy-osm-pbf-0.1.1.tar.gz (11.7 kB view hashes)

Uploaded Source

Built Distribution

esy_osm_pbf-0.1.1-py3-none-any.whl (12.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page