How to setblock custom banners with the right direction

Basically I'm creating this datapack that adds some markers in certain points of some structures. In game when the player gets near one of this markers I should setblock a custom banner (the design is saved on the storage), problem is that I don't know how to make sure that the banners always get created facing the right direction.

Continue to help post