You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please I get this error when I calculate route for multiple points/locations e.g.
var locations = new[]
{
new Coordinate(6.43513833145211f, 3.45599909557983f),
new Coordinate(6.43200924856121f, 3.46967836163486f)
};
var route = router.Calculate(bus, locations);
var routeGeoJson = route.ToGeoJson();
I get this error:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List1.get_Item(Int32 index) at Itinero.RouterBaseExtensions.TryCalculate(RouterBase router, IProfileInstance profile, IMassResolvingAlgorithm resolvingAlgorithm, Single turnPenalty, Tuple2[] preferredTurns, CancellationToken cancellationToken)
Please help out
The text was updated successfully, but these errors were encountered:
Don't know if you have figured this out already but I'll put this here for anyone else having issues with GPS coordinates.
Those GPS coordinates seem to show they are in the middle of the ocean, you might have your GPS coordinates reversed. I also recommend parsing the GPS points into router points. I find this gives better results when routing as it will snap the GPS point to the closest edge.
Here is a code snippet I like to use to convert, you could adapt it to process an array of coordinates if needed. This method will try different search distances incase the GPS point is pretty far away from the road / edge.
Another thing to be keep in mind is if you are getting errors with points not routing, make sure you're not on an island. I found this out when doing some routing in New Zealand the North Island roads only get added if you load island data were the South Island gets loaded without island data.
Here is how you can load island data
routerDb.AddIslandData(profile);
Hope this helps anyone that stumbles into the same issue
Hello,
Please I get this error when I calculate route for multiple points/locations e.g.
var route = router.Calculate(bus, locations);
var routeGeoJson = route.ToGeoJson();
I get this error:
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')
at System.Collections.Generic.List
1.get_Item(Int32 index) at Itinero.RouterBaseExtensions.TryCalculate(RouterBase router, IProfileInstance profile, IMassResolvingAlgorithm resolvingAlgorithm, Single turnPenalty, Tuple
2[] preferredTurns, CancellationToken cancellationToken)Please help out
The text was updated successfully, but these errors were encountered: