Taking into account the layer when selecting tiles.