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)
- openlr (PyPi package)
- For unittests, SQlite with spatialite extension is required
State
- ☑ Example map format
- ☑ Routing
- ☑ Candidate route rating
- ☑ Backtracking to get correct routes
- ☑ 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.
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 them 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
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)
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-0.9.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6735509a64c2a670038d7a2082458e62e43995ec0c25348d553174d7216f01d |
|
MD5 | c4f8fb9628ba05ecc696c10740717718 |
|
BLAKE2b-256 | 687a4b021944e3fdad23cb5654b953e4d32ffe968d40f36937b49acd2d77d43e |
Hashes for openlr_dereferencer-0.9.3-py3.6.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 584935b2df4388da7348b7bd545c0937bf978ec7485d61722ceadaaaaaa97c2e |
|
MD5 | 0a9300e8d8132033073e284b9a0cd513 |
|
BLAKE2b-256 | 5540a0b236d306dc41dc202d39ed72ac033021266087d515594e38a3c002c862 |
Hashes for openlr_dereferencer-0.9.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 872f6481a3d7c251f3242c6050eb92d856d718b58b484a3b0b7b2ceb65b0c31d |
|
MD5 | 4a26b5bd43fce2bdf05fce905ae06620 |
|
BLAKE2b-256 | 1dd0f3009fc2c1a440834da5259ad2b168d9ddd0602e49d2ab9917ce17c469b1 |