OpenLR location dereferencer
Project description
openlr-dereferencer
This is a Python package for decoding OpenLR™ location references on target maps.
Dependencies
- Python ≥ 3.6
- geographiclib (PyPi package)
- shapely (PyPi package)
- openlr (PyPi package)
- For unittests, SQlite with spatialite extension is required
State
- ☑ Decoding line locations
- ☑ Decoding 'point along line' locations
- ☑ Decoding 'POI with access point' locations
Structure
It is divided into the following submodules:
maps
Contains an abstract map class, which you may want to implement for your target map.
maps.wgs84
provides methods for reckoning with WGS84 coordinates.
example_sqlite_map
Implements the abstract map class for the example map format used in the unittests and examples
decoding
The actual logic for matching references onto a map.
This includes finding candidate lines and scoring them, and assembling a dereferenced location.
Installation
This project is available on PyPi:
pip3 install openlr-dereferencer
Usage
The decode(reference, mapreader)
function will take a location reference and return map objects.
Usage Example
First, implement the MapReader
class for your map. The example_sqlite_map
module is an implementation you may look at.
Second, construct a location reference. For instance, parse an OpenLR line location string:
from openlr import binary_decode
reference = binary_decode("CwmG8yVjzCq0Dfzr/gErRRs=")
Third, decode the reference on an instance of your map reader class:
from openlr_dereferencer import decode
real_location = decode(reference, mapreader)
real_location.lines # <- A list of map objects
Configuration
Candidates
The configuration value openlr_dereferencer.SEARCH_RADIUS
determines how far away from the LRP road candidates are searched.
The unit is meters, the default 100.
Scores
Every candidate line gets a score from 0
(bad) to 1
(perfect).
There are four scoring weight parameters:
- GEO_WEIGHT = 0.25
- FRC_WEIGHT = 0.25
- FOW_WEIGHT = 0.25
- BEAR_WEIGHT = 0.25
They determine how much influence a single aspect has on an overall candidate's score.
You may just change these before decoding:
from openlr_dereferencer.decoding import scoring
scoring.GEO_WEIGHT = 0.66
scoring.FRC_WEIGHT = 0.17
scoring.FOW_WEIGHT = 0.17
scoring.BEAR_WEIGHT = 0
A value of 0 means that the aspect has no influence on the candidate score, while a value of 1 means that it is the only aspect that matters.
Logging
openlr-dereferencer
logs all mapmatching decisions using the standard library logging
module.
Use it to turn on debugging:
import logging
logging.basicConfig(level=logging.DEBUG)
More Documentation
You are welcomed to read the generated API documentation at https://openlr-dereferencer-python.readthedocs.io.
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
Built Distributions
Hashes for openlr_dereferencer-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c523ded15d0d9e6ea9d5b8fca8e3f4f1bfc939245cc9fc3ce10b0b04a9fe5755 |
|
MD5 | 0c3c71b660f67b800071e53dddf6928b |
|
BLAKE2b-256 | 4c7e40570e97cc6ad96de15f772adb29d2c3ed934c9aaa2b0b7d259dd6fada77 |
Hashes for openlr_dereferencer-1.0.0-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b0a445395f581b9244c4d3a2a8e836742ffa4e49f63923c7ec2ca6733728baa |
|
MD5 | d96928482786d15af6841a9f2f607789 |
|
BLAKE2b-256 | 97a101e409786383d6930189d4378207369cdf74a5d4990b560097fee453510f |
Hashes for openlr_dereferencer-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04acfa4d4af664c51fb504ae826a747d9bbbc9194cea7f4ffb176dac71a24c55 |
|
MD5 | 376a941c7a59cde992527c35c2be599d |
|
BLAKE2b-256 | 9729919788c85c961ac2f4aaccdf725ece4640933f87e0c1a2c8a8ad448f06cd |