I've noticed that sometimes at can be translated to "a" instead of "en," and I think that I have a pretty good idea of when to use which, but, even after doing some diligent Googling, I can't seem to figure out what the rule is, if there is any.
Examples
I went to leave my friend at the airport.
Fui a dejar a mi amigo al aeropuerto.
or
We're going through security at the airport.
Pasamos por seguridad en el aeropuerto.
Is there any rule that says when which preposition should be used?