Understand encoded/decoded data

Hi, i’m new here.
I have a json map and I’m trying to decode the data string.
I’m sure it’s decoded right since it has a lot of zeros and 6 numbers that represent the object I put.

My problem is that those numbers are something like this 1258946560 and i have no idea why since the tile ID is 208.
That’s the string for this layer

AAAAAAAAAAAAAAAAAAAAAEsKAABMCgAATQoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABbCgAAXAoAAF0KAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAawoAAGwKAABtCgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==

I would like to know how i can understand those number better and maybe how TILED goes from a single tile to a number like this (for a single tileset or multiple in one layer).
I have to change dynamically the tiles but since I don’t understand those numbers is hard to reference the right tileset and specific tile.

Thank you for your time.

The global tile IDs include the flip flags in them, which is how you know which way the tile is flipped or rotated. To decode them, you need to extract those, and then figure out which tileset the tile belongs to based on its global ID and your tilesets’ firstgids. Then, you subtract the appropriate firstgid from the tile ID to give you the tileset-local ID of the tile, which you can use to render the tile and get its properties.

You can read more about the flags in the documentation:
https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#tile-flipping
(This documentation is for the TMX map format, but JSON is the same in this regard. Also note that there are actually four flags, not three. The fourth highest bit is used only for hexagonal maps, but even on non-hex maps it should still be cleared to guarantee the correct tile ID.)

Edit: The number you provided isn’t a valid GID with flags though. If that’s the actual number you saw and not just a keysmash, it’s possible you haven’t finished decoding the map. In addition to a base64 decode, you may need to do a decompression with the method appropriate to whatever compression method is set on the map.

Thank you fo your quick reply.
I used base64 uncompressed following a Phaser 3 tutorial, so I thought the only thing to do is decode.
I’ll read the doc even deeper and try again.

If it was base64 uncompressed and your Tile Layer Format was actually set to that, then your decoding should be done, and all that’s left is to deal with the flags and firstgids.