Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for contracted files: | |
TagsCollectionBase metaTags; | |
var serializer = new OsmSharp.Routing.CH.Serialization.CHEdgeFlatfileSerializer(); | |
var data = serializer.Deserialize( | |
new FileInfo(file_name_string_here).OpenRead(), out metaTags, false); | |
var router = Router.CreateCHFrom(data, new CHRouter(), interpreter); | |
// for regular files: | |
TagsCollectionBase metaTags; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using OsmSharp.Math.Geo; | |
using OsmSharp.Routing; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using OsmSharp.Math.Geo; | |
using OsmSharp.Routing; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Newtonsoft.Json; | |
using OsmSharp.Math.Geo; | |
using OsmSharp.Routing; | |
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vehicle.RegisterVehicles(); | |
var result = RoutingFacade.Calculate(Vehicle.Car, | |
new GeoCoordinate(-22.60101626185221, 17.081937789916992), new GeoCoordinate(-22.574389321905667, 17.07901954650879)); | |
Console.WriteLine(result); | |
//var metrics = new TimeCalculator(new OsmRoutingInterpreter()); | |
//metrics.Calculate(result); | |
var instructions = InstructionGenerator.Generate(result, new OsmRoutingInterpreter()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using OsmSharp.Collections.Tags; | |
using OsmSharp.Routing; | |
using OsmSharp.Routing.CH; | |
using OsmSharp.Routing.Osm.Interpreter; | |
using System.IO; | |
namespace ConsoleApplication2 | |
{ | |
class Program | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sourceStream = new PBFOsmStreamSource( | |
new FileInfo(@"path\to\file.osm.pbf").OpenRead()); | |
var completeStreamSource = new OsmSimpleCompleteStreamSource(sourceStream); | |
foreach(var osmGeoComplete in completeStreamSource) | |
{ | |
if(osmGeoComplete.Type == Osm.CompleteOsmType.Way && | |
osmGeoComplete.Tags != null && | |
osmGeoComplete.Tags.ContainsKey("highway")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sourceStream = new PBFOsmStreamSource( | |
new FileInfo(@"path\to\file.osm.pbf").OpenRead()); | |
foreach(var osmGeo in sourceStream) | |
{ | |
if(osmGeo.Type == Osm.OsmGeoType.Way && | |
osmGeo.Tags != null && | |
osmGeo.Tags.ContainsKey("highway")) | |
{ | |
// do something with the road here. |
OlderNewer