Created
July 20, 2014 15:56
-
-
Save xivk/d01c899f5ff46b9f2146 to your computer and use it in GitHub Desktop.
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 | |
{ | |
static void Main(string[] args) | |
{ | |
// create serializer. | |
var routingSerializer = new OsmSharp.Routing.CH.Serialization.Sorted.CHEdgeDataDataSourceSerializer(); | |
// serialize/deserialize. | |
var metaData = new TagsCollection(); | |
var graph = routingSerializer.Deserialize(new FileInfo(@"C:\Users\xivk\Downloads\Routes.osm.routing").OpenRead(), false) | |
var router = Router.CreateCHFrom(graph, new CHRouter(), new OsmRoutingInterpreter()); | |
var resolved1 = router.Resolve(Vehicle.Car, new OsmSharp.Math.Geo.GeoCoordinate(47.4234351, -103.3960672)); | |
var resolved2 = router.Resolve(Vehicle.Car, new OsmSharp.Math.Geo.GeoCoordinate(46.8108147, -102.7004338)); | |
var route = router.Calculate(Vehicle.Car, resolved1, resolved2); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment