In 1802, King Gia Long ascended the throne and began the Nguyen Dynasty, with Phu Xuan being the capital, Thang Long remained the chief center of North Vietnam with 11 tran (a provincial equivalence).
In 1831, Emperor Ming Mang reorganized the administrative mechanism, abolishing the tran and dividing the country into 29 provinces. Hanoi is one province with the former Thang Long Citadel as the chief town.
Compared with the preceding period, Hanoi’s economic development during the first half of the 19th century was less steady. The wards and hamlets in the west and south tended to specialize in agricultural production and handicrafts as their sidelines. The urbanization of Hanoi was concentrated in the eastern and south-eastern areas which were crisscrossed with streets and adorned with houses adjoining one another. The Palace of the Trinh Lords was demolished in 1787 by King Le Chieu Thong and the area around the Lake of the Restored Sword quickly became a residential area with booming trade and handicrafts.
Changes took place in the cultural arena as well. National University (Quoc Tu Giam) was moved to Hue and the Temple of Literature (Van Mieu) was put under the care of the authorities of Hanoi. The preliminary examination ground (Truong Thi Huong) was then located in the present-day Trang Thi Street. Hoe Nhai ward, which would become later Hang Giay Street, was the center for entertainment activities. Some of the entrance gates to Hanoi were rebuilt, including the Quan Chuong gate (1817).
In particular, several individuals collected money to build religious structures, such as the compound of Ngoc Son Temple (by Nguyen Van Sieu) and the 108-compartment Bao An Pagoda close to the Lake of the Restored Sword.