static void Main(string[] args) { Download.ToFile("http://files.itinero.tech/data/OSM/planet/europe/luxembourg-latest.osm.pbf", "luxembourg-latest.osm.pbf").Wait(); // 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("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. // REMARK: this functionality is NOT part of the OpenLR-spec, just a convenient way to build a line location. 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); Console.WriteLine(encoded); // decode this location. var decodedLine = coder.Decode(encoded) as ReferencedLine; #if DEBUG Console.ReadLine(); #endif }
/// <summary> /// Downloads and extracts the given file. /// </summary> public static void DownloadAndExtractShape(string url, string filename) { Download.ToFile(url, filename).Wait(); Extract(filename); }