itinero / routing2

The next version of the Itinero route planner.
Apache License 2.0
7 stars 1 forks source link

Snapping to a point fails after serialization and preparing the routerdb again #26

Closed pietervdvn closed 2 years ago

pietervdvn commented 3 years ago

In the following case, a crash happens:

var routerDb = new RouterDb...
routerDb.prepareFor(profile1)
routerDb.prepareFor(profile2)
routerDb.useOsmStream(...)
routerDb.WriteTo(file)
routerDb = RouterDb.ReadFrom(file)

routerDb.prepareFor(profile1)
routerDb.prepareFor(profile2)
routerDb.Snap( ... ) // crashes

I spent quite some hours figuring this out. I assumed that 'prepareFor' would be idempotent; but it clearly isn't. Maybe an error could be thrown in case of this misuse?