Hello people, I'm writing a parser in C# for PBF dumps. However, I'm having issues with the Delta-{en|de}coding. I thought I succesfully implemented the decoding when I saw "correct" latitudes/longitudes, with the following (pseudo-)code:
---8<--- function decode(delta) { ret = [] for (i=0; i < delta.Count; i++) { if (i == 0) { ret.append(delta[0]) continue } ret.append(delta[0] + delta[i]) } return ret } --->8--- This worked great with latitudes/longitudes, which I converted with the "OUT = IN * granularity / 10**9" formula I found in the .proto. However, it seems that I can't understand the way user_sid is encoded. I tried to apply the same function, but it returned negative numbers at a certain point, and I obviously had an OutOfRange exception. I must also say that I originally thought that the delta-encoding worked like this: 1) write the first number, at list[0] 2) at position n, write the result of "list[n-1] - list[n]" Did I just miss the correct documentation? Thank you, David -- . ''`. Debian developer | http://wiki.debian.org/DavidPaleino : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/ `. `'` GPG: 1392B174 ----|---- http://deb.li/dapal `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
signature.asc
Description: PGP signature
_______________________________________________ dev mailing list dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/dev