A powerful 7.7 magnitude earthquake hit the Thai capital of Bangkok, causing buildings to sway and people to evacuate them.