# How do I convert a "log id" (numeric) into the log page name (starts GL)?

## Recommended Posts

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.

Try the GC-code to/from ID conversion tool in the Geocaching Toolbox. It gives the correct result for the example you gave.

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 by HHL

I will try base 31. Thank you.

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
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.

16 -> 10 also hex. I'll experiment to find it. Thanks.

Have a look here:

1 minute ago, Die Batzen said:

Have a look here:

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)```
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).

I guess you all know what you are talking about, I sure don't!

## 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.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.