itinero / routing

The routing core of itinero.
Apache License 2.0
220 stars 70 forks source link

System.ArgumentOutOfRangeException: 'Non-negative number required. Parameter name: capacity' on calling Router.Calculate() #334

Open goet opened 3 years ago

goet commented 3 years ago

Itinero throws the following error both in my main project and in the small test project I've tried to test it out:

System.ArgumentOutOfRangeException
  HResult=0x80131502
  Message=Non-negative number required.
Parameter name: capacity
  Source=Itinero
  StackTrace:
   at Itinero.Result`1.get_Value()
   at Itinero.RouterBaseExtensions.Calculate(RouterBase router, IProfileInstance profile, Single sourceLatitude, Single sourceLongitude, Single targetLatitude, Single targetLongitude)
   at ItineroTest.Program.Main(String[] args) in Program.cs:line 25

The test project only contains the following code, the exception is thrown on the router.Calculate line. This project is a barebones C# .Net framework console application, with Itinero/Itinero.Osm installed through nuget. The file I'm trying to use is the latest .osm.pbf from geofabrik https://download.geofabrik.de/europe/hungary.html, I've tried multiple ones but it didn't seem to have any effect on the error.

            var routerDb = new RouterDb();
            using (var stream = new FileInfo(@"path-to-test-osm.pbf").OpenRead())
            {
                routerDb.LoadOsmData(stream, Vehicle.Car);
            }
            var router = new Router(routerDb);

            // calculate a route.
            var route = router.Calculate(Vehicle.Car.Fastest(),
                237.7268f, 95.20176f, 285.2412f, 114.2625f);

Since this issue only seems to be happening to me, I'm guessing some external dependency is silently broken, but I'm not exactly sure what. Any leads on how to fix it would be greatly appreciated. I'm using Itinero 1.5.0, and the system has plenty of RAM and CPU power available to it while the error happens.