itinero / OpenLR

A C# Implementation of the OpenLR specification using Itinero.
https://www.itinero.tech
Other
18 stars 12 forks source link

Incorrect LineLocation encoding #93

Open AndersHGP opened 5 years ago

AndersHGP commented 5 years ago

Hi!

Step 9 in the LineLocation encoding is a little broken. It only works for 2 points. If you have more than 2 points it will only adjust the first 2 points and then move on to step 10 without checking the trailing point pairs if they are more than 15000 meters.

xivk commented 5 years ago

This library is very important in several projects so thanks for your feedback.

I looked at the code myself and I see what you mean. Did you discover this by reading the code? :+1:

It's on my list to fix but doesn't have a very high priority at the moment to be honest, this case is pretty rare. Did you run into this with a real-world case?

AndersHGP commented 5 years ago

No problems mate!

I did not discover it by reading the code.

I discovered it when using the library and trying to encode very long routes.

xivk commented 5 years ago

Ah interesting!

If you can give me a simple test to reproduce the incorrect behaviour that would probably lead to a quick fix. Otherwise, it could be a while for me to get to fix this (because so busy with other stuff sorry).

A pull request is also welcome, if there are proper tests for the changed behaviour. I've noticed with this library the tests are absolutely crucial.