Skip to content

geopinionated/openlr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenLR Rust implementation

Binary (and Base64) ser/deserialization of OpenLR Location References (version 3) with basic support for line encoder and decoder capabilities.

White Paper

Reference Implementation (Java)

License

Licensed under either of

Examples

Serialization

use openlr::{Coordinate, LocationReference, deserialize_base64_openlr, serialize_base64_openlr};

let location = LocationReference::GeoCoordinate(Coordinate {
    lon: 13.090918,
    lat: 52.466884,
});

let encoded: String = serialize_base64_openlr(&location).unwrap();
let decoded: LocationReference = deserialize_base64_openlr(&encoded).unwrap();

Decoding and Encoding

use openlr::{
    DecoderConfig, DirectedGraph, EncoderConfig, Location, decode_base64_openlr, encode_base64_openlr
};

struct RoadNetworkGraph;

type VertexId = i64;
type EdgeId = i64;

impl DirectedGraph for RoadNetworkGraph {
    type VertexId = VertexId;
    type EdgeId = EdgeId;

    // TODO: implement DirectedGraph methods
}

let graph = RoadNetworkGraph;

let location: Location<EdgeId> =
    decode_base64_openlr(&DecoderConfig::default(), &graph, "CwmShiVYczPJBgCs/y0zAQ==").unwrap();

let location: String =
    encode_base64_openlr(&EncoderConfig::default(), &graph, location).unwrap();

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages