# CSV values offset

**URL:** <https://discourse.mapeditor.org/t/csv-values-offset/209>\
**Category:** Questions\
**Created:** [January 28, 2015, 11:15pm UTC](https://discourse.mapeditor.org/t/csv-values-offset/209 "2015-01-28T23:15:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ivodopiviz](https://avatars.discourse-cdn.com/v4/letter/i/c68b51/32.png) [@ivodopiviz](https://discourse.mapeditor.org/u/ivodopiviz)\
**Post date:** [January 28, 2015, 11:15pm UTC](https://discourse.mapeditor.org/t/csv-values-offset/209/1 "2015-01-28T23:15:07Z")

</div>

Hi,

I’m having a weird problem with Tiled. I’m currently using it to build some simple tilemaps that I need as CSV files. In fact, I only need the CSV part, so I manually rip out the CSV values from the TMX file. However, the exported CSV values seem to be offset by one when compared to the values show inside the editor. For example: a tile with ID 17 inside the editor is saved as ID 18 in the CSV table of the TMX file.

It’s probably a simple configuration error, but for the life of me I can’t find it anywhere? Any ideas?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Ablu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/ablu/32/1496_2.png) [@Ablu](https://discourse.mapeditor.org/u/Ablu)\
**Post date:** [January 29, 2015, 11:30am UTC](https://discourse.mapeditor.org/t/csv-values-offset/209/2 "2015-01-29T11:30:31Z")

</div>

Please read the [section of the file format definition](https://github.com/bjorn/tiled/wiki/TMX-Map-Format#data) carefully. It explains why there is an offset. (In short: the offset is the `firstgid` of the tileset you used. If you only have one tileset it is `+1` everywhere. But with more tilesets you can get higher numbers.

Also: If you only need the CSV part. You might want to check out the new CSV export format in tiled 0.11.0! Then you can save yourself from ripping the csv part out always 😄

Regards,  
Ablu

---

<div class="post-metadata">

**Author:** ![ivodopiviz](https://avatars.discourse-cdn.com/v4/letter/i/c68b51/32.png) [@ivodopiviz](https://discourse.mapeditor.org/u/ivodopiviz)\
**Post date:** [January 29, 2015, 5:38pm UTC](https://discourse.mapeditor.org/t/csv-values-offset/209/3 "2015-01-29T17:38:40Z")

</div>

Thanks for the help! So… “TMX loader” libraries need to substract the firstgid value to get the proper tile ID…?

Anyway, problem solved with 0.11.0. The CSV exporter seems to only export the “lowest” layer in the layer list, but otherwise it’s fine.

Thanks again 😄

---

<div class="post-metadata">

**Author:** ![Ablu](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/ablu/32/1496_2.png) [@Ablu](https://discourse.mapeditor.org/u/Ablu)\
**Post date:** [January 29, 2015, 7:24pm UTC](https://discourse.mapeditor.org/t/csv-values-offset/209/4 "2015-01-29T19:24:54Z")

</div>

> [@ivodopiviz](#):
>
> Thanks for the help! So… “TMX loader” libraries need to substract the firstgid value to get the proper tile ID…?

Yep 🙂 It would need to subtract the `firstgid` of the tileset which has the highest `firstgid` lower or equal than the actual tile id (the tile belongs to the tileset with that `firstgid` then).
