Skip to main content

The core of the BSSD project

Project description

BSSD Core

Install

Using pip

pip install bssd-core

This will install the latest version of the bssd core library available in PyPI to your environment.

Manual installation from source

Install the package into your local python3 virtual environment:

  • Clone the source code to a directory of your choice
git clone https://gitlab.com/tuda-fzd/scenery-representations-and-maps/bssd-core.git path/to/bssd-core-src/

If you are using virtual environments, make sure to activate the correct environment to install the library into e.g:

source /<path-to-my-project>/.venv/bin/activate

Install the library:

pip install -e path/to/bssd-core-src/

Usage

The package is build as an extension of pyosmium. Following is a simple example on how to use the library. The referenced objects from the handler are only temporary. If data is wished to be stored it must be copied out.

import osmium
from bssd.core import BSSDHandler, Reservation
from bssd.core import mutable


class Handler(BSSDHandler):
    def __init__(self):
        super().__init__()
        self.writer = osmium.SimpleWriter("out.osm")

    # callback function for reservations
    def reservation(self, r: Reservation):
        # r is readonly, to change r it must be converted
        r: mutable.Reservation = r.make_mutable()
        r.bicycle = True
        # write the changed reservation to the output file
        self.writer.add_relation(r.get_osmium())


if __name__ == "__main__":
    h = Handler()
    h.apply_file("in.osm")

BSSDHandler callback functions

These callback functions need to be implemented in the inheriting class to be used. The function will receive the specified objects after calling apply_file(). The relation callback can be used to read non BSSD elements.

  • behavior_space(core.BehaviorSpace)
  • behavior(core.Behavior)
  • boundary_lat(core.BoundaryLat)
  • boundary_long(core.BoundaryLong)
  • reservation(core.Reservation)
  • relation(osm.Relation)

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

bssd_core-0.1.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

bssd_core-0.1.2-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file bssd_core-0.1.2.tar.gz.

File metadata

  • Download URL: bssd_core-0.1.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for bssd_core-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f165ef13bdbe7c3ac16e3ba8c62ed566ea340616f258a032a64b3e62960cb9b3
MD5 ba4e4eebbe2ca1e542915343f6aec708
BLAKE2b-256 6c2d113e05c05ba189816bae2e6bdca01f7337f64efd86c07fd0b8937ea1490f

See more details on using hashes here.

File details

Details for the file bssd_core-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: bssd_core-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.10

File hashes

Hashes for bssd_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bf7c75e0dda9acecb0e276f5e6c1cebaebf68bc57d1b245931381a1224eb30ff
MD5 637234a46f4962e29dadfcf50b4215a5
BLAKE2b-256 97423ae0e49057ebed92405406538354d50b5bed512b578b00603c5a9ea6aeb6

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