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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file esy-osm-pbf-0.1.1.tar.gz.

File metadata

  • Download URL: esy-osm-pbf-0.1.1.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.9.6 requests/2.28.1 setuptools/63.2.0 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.7

File hashes

Hashes for esy-osm-pbf-0.1.1.tar.gz
Algorithm Hash digest
SHA256 5b65bb2c51911f5c88c28134819bec53139cffd6b7f4b2f246337c8cd7bd8ff4
MD5 db3515cdb02f4c0311a11d57b29b7d78
BLAKE2b-256 b5145242bc6a813335abde5f6a956cf1da68746a49a12ce152d6ae3a45cbb9d4

See more details on using hashes here.

File details

Details for the file esy_osm_pbf-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: esy_osm_pbf-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.9.6 requests/2.28.1 setuptools/63.2.0 requests-toolbelt/0.9.1 tqdm/4.64.1 CPython/3.10.7

File hashes

Hashes for esy_osm_pbf-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe3bb98b83124c536002f15204d500e2a2413c15009d403361f3c22718f19185
MD5 35c96fbc42d818f4a329acd04176812a
BLAKE2b-256 001ac553a8fb0355b7619c8c1364d3b24f32f24e8b2a16a94b764bcc5f308bc7

See more details on using hashes here.

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