Skip to content

itinero/OpenLR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c167439 · Apr 25, 2024
Apr 25, 2024
Jan 23, 2020
Apr 25, 2024
Apr 25, 2024
Apr 3, 2019
Sep 5, 2016
Apr 25, 2024
Apr 25, 2024
Jan 17, 2019
Dec 18, 2017
Jan 17, 2020

Repository files navigation

OpenLR for .NET

Build status Visit our website GPL licensed

  • OpenLR: NuGet Badge
  • OpenLR.Geo: NuGet Badge

This is an implementation of the OpenLR (Open Location Reference) protocol using Itinero. Development was initially sponsered by via.nl (http://via.nl/) and Be-Mobile (http://www.be-mobile-international.com/).

Dependencies

  • Itinero: For a basic routing graph structure, loading data and routing.

Usage

The basics

By default, just like in Itinero, all code is there to decode/encode based on an OpenStreetMap network.

The most basic code sample encoding/decoding a line location:

    // build routerdb from raw OSM data.
    // check this for more info on RouterDb's: https://github.com/itinero/routing/wiki/RouterDb
    var routerDb = new RouterDb();
    using (var sourceStream = File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "luxembourg-latest.osm.pbf")))
    {
        routerDb.LoadOsmData(sourceStream, Vehicle.Car);
    }

    // create coder.
    var coder = new Coder(routerDb, new OsmCoderProfile());

    // build a line location from a shortest path.
    var line = coder.BuildLine(new Itinero.LocalGeo.Coordinate(49.67218282319583f, 6.142280101776122f),
        new Itinero.LocalGeo.Coordinate(49.67776489459803f, 6.1342549324035645f));

    // encode this location.
    var encoded = coder.Encode(line);

    // decode this location.
    var decodedLine = coder.Decode(encoded) as ReferencedLine;

Samples & Docs

Check the samples here: https://github.com/itinero/OpenLR/tree/develop/samples/

There is also basic documentation here: https://github.com/itinero/OpenLR/wiki

About

A C# Implementation of the OpenLR specification using Itinero.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published