に: location + STATE

で: Location + ACTION verb

ex: to study in Japan
日本で勉強する

ex: to eat on the couch
ソファで食べる