Python bindings for liblrs: a library to work with linear referencing systems
Project description
LibLRS Python
Usage
Simply add liblrs-python
to your dependencies.
import liblrs_python as lrs
plm = lrs.Lrs(open("path_to_your_lrs_file", "rb").read())
# We build a dict mapping for each LRM id to its handle
lrms = {plm.get_lrm_scale_id(i): i for i in range(plm.lrm_len())}
# We find the handle for the Via Aurelia (https://en.wikipedia.org/wiki/Via_Aurelia)
via_aurelia_handle = [v for k,v in lrms.items() if k.startswith("Via Aurelia")][0]
# We define two measures meaning “100 passus after milestone 50”
# (passus = step in latin, could be any measurement unit)
a = lrs.LrmScaleMeasure("50", 100)
b = lrs.LrmScaleMeasure("60", 200)
# Get the coordinates between those two measures
coordinates = [[p.x, p.y] for p in plm.resolve_range(via_aurelia_handle, a, b)]
Developpment
Create your virtualenv and install maturin:
python -m venv venv-liblrs
source venv-liblrs/bin/activate
pip install
maturin develop
Bindings with PyO3 to liblrs
Publishing
We publish the library to PYPI running:
docker run --rm -e MATURIN_PYPI_TOKEN=PYPI_key -w /io/python -v $(pwd)/..:/io ghcr.io/pyo3/maturin publish
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
liblrs_python-0.1.7.tar.gz
(51.2 kB
view hashes)
Built Distribution
Close
Hashes for liblrs_python-0.1.7-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8507d60fead70eaf6ce270a5ebd779ef5b764d5610ac9b95c28980c7f0394b24 |
|
MD5 | a192b020ab4930f790dcee30d9a73a72 |
|
BLAKE2b-256 | 07996b2f538a4ca81ced9d0bc796d2343b73b4f02dda522e53a4d078205ad171 |