procedural tmx tile layers

more tmx woes.

How can I generate a layer on an imported tilemap using an image from a tileset in the tmx map?

idea while writing this:
maybe I could save a nearly empty layer using tiled with 1 tile (to link with a tileset)
Then remove that tile , and generate the tilemap according to how I want the tiles to be placed.