# First tile id is 0, no tile id is also 0

**URL:** <https://discourse.mapeditor.org/t/first-tile-id-is-0-no-tile-id-is-also-0/4904>\
**Category:** Questions\
**Created:** [January 4, 2021, 8:16am UTC](https://discourse.mapeditor.org/t/first-tile-id-is-0-no-tile-id-is-also-0/4904 "2021-01-04T08:16:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bogomip](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bogomip/32/3145_2.png) [@Bogomip](https://discourse.mapeditor.org/u/Bogomip)\
**Post date:** [January 4, 2021, 8:16am UTC](https://discourse.mapeditor.org/t/first-tile-id-is-0-no-tile-id-is-also-0/4904/1 "2021-01-04T08:16:49Z")

</div>

I have a map with a few layers. The background layer and a collisions layer are the most important.

The collisions layer is obviously mostly empty as there are a few platforms, floor etc for the player to stand on (its a vertical scroller) but those empty tiles are set to 0 in the JSON export. The problem is there is also a tile with an ID of 0, so its unable to differentiate between no tile, and the tile with ID 0.

I’m pretty new to Tiled and have been struggling to find an option where I can set “no tile” to something like -1 so I can differentiate. I would rather not change the tileset to begin with an ID of 1 if possible, though if this is the best solution im sure I can make it work 🙂 Any support is gratefully received! 🙂

Thanks,  
Bogo

---

<div class="post-metadata">

**Author:** ![eishiya](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/eishiya/32/2534_2.png) [@eishiya](https://discourse.mapeditor.org/u/eishiya)\
**Post date:** [January 4, 2021, 4:30pm UTC](https://discourse.mapeditor.org/t/first-tile-id-is-0-no-tile-id-is-also-0/4904/2 "2021-01-04T16:30:49Z")

</div>

Global tile IDs (GIDs) found in _maps_ and tileset-local IDs found in _tilesets_ are different. GIDs begin at 1, with 0 being the empty tile. Tileset-local IDs begin at 0.

Every tileset listed in a map has a `firstgid` property. You need to subtract this number from the GID to get the tileset-local ID. So, GID 0 means no tile, and GID 1 means the 0th tile in the first tileset (which will have `firstgid` 1).

The `firstgid` is also how you can tell which tile belongs to which tileset when you have multiple tilesets in a map. The tile belongs to the tileset that has the greatest `firstgid` smaller than or equal to the GID you’re looking at.

---

<div class="post-metadata">

**Author:** ![Bogomip](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bogomip/32/3145_2.png) [@Bogomip](https://discourse.mapeditor.org/u/Bogomip)\
**Post date:** [January 4, 2021, 5:57pm UTC](https://discourse.mapeditor.org/t/first-tile-id-is-0-no-tile-id-is-also-0/4904/3 "2021-01-04T17:57:46Z")

</div>

Hi eishiya,

Thanks so much - that makes sense, I just offset everything by one and treat 0 as ‘no tile’ and everything looks alot better 🙂

Thanks again!  
Bogo
