+===sgb Posted May 15, 2021 Share Posted May 15, 2021 How do I convert a "log id" (numeric) into the log page name (starts GL)? The "My Finds" GPX file you can download from the Pocket Query page includes log ids as a number (eg 16183305). When you view that log on the website, it has an alphanumeric name starting GL (for the above log, it is GLHZ0W1) It is not a simple "base 36" conversion between the two. What is the conversion algorithm please. Quote Link to comment
+barefootjeff Posted May 15, 2021 Share Posted May 15, 2021 Try the GC-code to/from ID conversion tool in the Geocaching Toolbox. It gives the correct result for the example you gave. Quote Link to comment
+HHL Posted May 15, 2021 Share Posted May 15, 2021 (edited) 52 minutes ago, ===sgb said: What is the conversion algorithm please It's Base31. Groundspeak's reference code never contains: ISOUL I use a GSAK macro to do the maths: Edited May 15, 2021 by HHL Quote Link to comment
+===sgb Posted May 16, 2021 Author Share Posted May 16, 2021 I will try base 31. Thank you. Quote Link to comment
+===sgb Posted May 16, 2021 Author Share Posted May 16, 2021 No base 31 doesn't work. 16183305 remainder 0123456789ABCDEFGHJKMNPQRTVWXYZ (wanted) 522042 3 2 1 16840 2 1 W 543 7 6 0 17 16 F Z 0 17 G H Quote Link to comment
+===sgb Posted May 16, 2021 Author Share Posted May 16, 2021 On 5/15/2021 at 8:24 AM, barefootjeff said: Try the GC-code to/from ID conversion tool in the Geocaching Toolbox. It gives the correct result for the example you gave. This is to convert between GCcode and ID (cache) not GLcode and ID (log). But as you say, it gets it right albeit GCHZ0W1 not GLHZ0W1. But that should be enough for me to determine the algorithm. 1..15 -> 1..F (hexadecimal) 16 -> 10 also hex. I'll experiment to find it. Thanks. Quote Link to comment
+Die Batzen Posted May 16, 2021 Share Posted May 16, 2021 Have a look here: https://api.Groundspeak.com/documentation#referencecodes 1 Quote Link to comment
+===sgb Posted May 16, 2021 Author Share Posted May 16, 2021 1 minute ago, Die Batzen said: Have a look here: https://api.Groundspeak.com/documentation#referencecodes THANK you - that was what I was seeking. Excellent. Base16_Characters = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' ] Base31_Characters = [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'T', 'V', 'W', 'X', 'Y', 'Z' ] Id to Reference Code -------------------- If Id < 65536 ReferenceCode = Base16(Id) // Decimal to Hex else ReferenceCode = Base31(Id + 411120) Reference Code to Id -------------------- if Prefix == "GC" ReferenceCode = Replace(code, "S", "5") ReferenceCode = Replace(code, "O", "0") ReferenceCode = RemovePrefix(ReferenceCode) FirstChar = substring(ReferenceCode, 0, 1) if len(ReferenceCode) >= 5 or FirstChar >= 'G' Id = Base31(ReferenceCode) - 411120 else Id = Base16(ReferenceCode) Quote Link to comment
+barefootjeff Posted May 16, 2021 Share Posted May 16, 2021 47 minutes ago, ===sgb said: This is to convert between GCcode and ID (cache) not GLcode and ID (log). But as you say, it gets it right albeit GCHZ0W1 not GLHZ0W1. But that should be enough for me to determine the algorithm. The same encoding is used for caches (GC prefix), logs (GL prefix) and trackables (TB prefix). Quote Link to comment
+Jayeffel Posted May 18, 2021 Share Posted May 18, 2021 I guess you all know what you are talking about, I sure don't! 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.