Closed emij closed 7 years ago
Thanks again! 👍
Carefull if you are using the above code:
lineLocation.PositiveOffsetPercentage = (location.PositiveOffsetPercentage == null) ? 0 : location.PositiveOffsetPercentage.Value; lineLocation.NegativeOffsetPercentage = (location.NegativeOffsetPercentage == null) ? 0 : location.PositiveOffsetPercentage.Value;
https://github.com/itinero/OpenLR/blob/3b3908363be42a6fc07174e5c99fee59041dcf39/OpenLR/Referenced/Codecs/ReferencedLineCodec.cs#L172
What I could gather from the OpenLR specification the offset values are optional. I got an exception because the binary-encoded locations I tried to decode did not have these values, so I changed line 172 and 173 to:
lineLocation.PositiveOffsetPercentage = (location.PositiveOffsetPercentage == null) ? 0 : location.PositiveOffsetPercentage.Value; lineLocation.NegativeOffsetPercentage = (location.NegativeOffsetPercentage == null) ? 0 : location.PositiveOffsetPercentage.Value;
I also noticed this: https://github.com/itinero/OpenLR/blob/develop/samples/Samples.OSM/Program.cs#L64
should be: "decodedLine.toFeatures...", right?