に indicates the location of existence, whereas で is for the location of action/movement whether transitive or intransitive.
e.g.
昨日[きのう]公園[こうえん]で遊[あそ]びました。
(遊ぶ is intransitive, but it's nothing to do with で. 遊ぶ is an action, so で is used here. )
立っていました is existence, that's the reason of に.