# Copying entire layers from tmx to tmx?

**URL:** <https://discourse.mapeditor.org/t/copying-entire-layers-from-tmx-to-tmx/4564>\
**Category:** Questions\
**Created:** [June 13, 2020, 7:54pm UTC](https://discourse.mapeditor.org/t/copying-entire-layers-from-tmx-to-tmx/4564 "2020-06-13T19:54:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KgothatsoN](https://avatars.discourse-cdn.com/v4/letter/k/439d5e/32.png) [@KgothatsoN](https://discourse.mapeditor.org/u/KgothatsoN)\
**Post date:** [June 13, 2020, 7:54pm UTC](https://discourse.mapeditor.org/t/copying-entire-layers-from-tmx-to-tmx/4564/1 "2020-06-13T19:54:14Z")

</div>

Is there a way to copy a layer from one tmx map to another map? Whilst retaining all it’s properties

---

<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:** [June 13, 2020, 8:49pm UTC](https://discourse.mapeditor.org/t/copying-entire-layers-from-tmx-to-tmx/4564/2 "2020-06-13T20:49:58Z")

</div>

I’m not aware of a GUI-based way that keeps the properties, but you can copy+paste the relevant code from one TMX file to another in a text editor. You’ll need to also change the layer’s ID (`<layer id="##"`) so that it doesn’t match any existing layers and set the map’s `nextlayerid` to the largest current layer id +1, to make sure that subsequent layers made in the file are made correctly.

---

<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:** [June 14, 2020, 9:55am UTC](https://discourse.mapeditor.org/t/copying-entire-layers-from-tmx-to-tmx/4564/3 "2020-06-14T09:55:29Z")

</div>

When doing it manually, you’ll also need to make sure the other map refers to the used tilesets and that they are using the same `firstgid` value.

I think it would in general be better to just do it in two steps, first copy the tiles or objects and then copy the properties (custom properties can be group-selected and copy/pasted all at once).

---

<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:** [June 14, 2020, 3:36pm UTC](https://discourse.mapeditor.org/t/copying-entire-layers-from-tmx-to-tmx/4564/4 "2020-06-14T15:36:11Z")

</div>

> [@bjorn](#):
>
> (custom properties can be group-selected and copy/pasted all at once)

I had no idea this was possible! In this case, copying the code seems like a waste of time, it would take longer than to just copy the tiles and then the properties.
