OpenLR icon indicating copy to clipboard operation
OpenLR copied to clipboard

Incorrect LineLocation encoding

Open AndersHGP opened this issue 6 years ago • 3 comments

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.

AndersHGP avatar Jun 05 '19 14:06 AndersHGP

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?

xivk avatar Jun 05 '19 14:06 xivk

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.

AndersHGP avatar Jun 05 '19 14:06 AndersHGP

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.

xivk avatar Jun 05 '19 14:06 xivk