Yingzao Fashi
During the Song dynasty, the city of Bianjing had three enclosures: the outer city wall, the inner city wall, and the palace at the center. The inner city was rectangular, with three doors on each side. The palace enclosure was also rectangular, with a watch tower on each of the four corners. It had four main gates: Xihua Gate to the west, Donghua Gate to the east, Gongchen Gate to the north, and Xuande Gate, also known as Duan Gate or Xuandelou, at the south. Xuande Gate had five-paneled doors, painted red and decorated with gold tacks; its walls were lavishly decorated with dragon, phoenix and floating-cloud patterns to match the carved beams, painted rafters and glazed-tile roof. There were also two glazed dragons, each biting an end of the rooftop ridge, its tail pointing to the sky. The symbolic function of these "chi wei" was explained in Yingzao Fashi: