# \[Scripting API\] How to associate the coordinates of object layer and tiled layer?

**URL:** <https://discourse.mapeditor.org/t/scripting-api-how-to-associate-the-coordinates-of-object-layer-and-tiled-layer/6636>\
**Category:** Questions\
**Created:** [March 14, 2024, 9:15am UTC](https://discourse.mapeditor.org/t/scripting-api-how-to-associate-the-coordinates-of-object-layer-and-tiled-layer/6636 "2024-03-14T09:15:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cupenoruler](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/cupenoruler/32/4494_2.png) [@cupenoruler](https://discourse.mapeditor.org/u/cupenoruler)\
**Post date:** [March 14, 2024, 9:15am UTC](https://discourse.mapeditor.org/t/scripting-api-how-to-associate-the-coordinates-of-object-layer-and-tiled-layer/6636/1 "2024-03-14T09:15:05Z")

</div>

Is there any API for it?

My original need was just add a displayable custom property for tile, also for empty tile. So I make a object layer for it, but the coordinates between them was quit differentce.

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [March 14, 2024, 9:20am UTC](https://discourse.mapeditor.org/t/scripting-api-how-to-associate-the-coordinates-of-object-layer-and-tiled-layer/6636/2 "2024-03-14T09:20:26Z")

</div>

You can convert from tile coordinates to pixel coordinates (for positioning objects) using [`tileToPixel`](https://www.mapeditor.org/docs/scripting/classes/TileMap.html#tileToPixel), and the other way around using [`pixelToTile`](https://www.mapeditor.org/docs/scripting/classes/TileMap.html#pixelToTile). Does that help?

---

<div class="post-metadata">

**Author:** ![cupenoruler](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/cupenoruler/32/4494_2.png) [@cupenoruler](https://discourse.mapeditor.org/u/cupenoruler)\
**Post date:** [March 14, 2024, 9:25am UTC](https://discourse.mapeditor.org/t/scripting-api-how-to-associate-the-coordinates-of-object-layer-and-tiled-layer/6636/3 "2024-03-14T09:25:56Z")

</div>

Yes, that’s it. Thank you kindly.
