Beijing lies on the northern tip of the North China Plain, in northeastern China. The Xishan and Jundu mountains to the north and northwest separate the city and the surrounding agricultural lands from the encroaching Gobi desert steppes.
The city itself lies on flat land (elevation 20 to 60 meters) that opens to the east and south. The Great Wall of China, which stretches across the northern edge of the municipality, made use of this rugged topography to seal an opening and defend against nomadic incursions from what is now called Inner Mongolia. The same mountains that protected ancient China from nomadic invasions now serve as a bowl that traps air pollution.
A few hours drive east of Beijing is the Bohai Sea, an inlet of the Yellow Sea, which receives the Yongding, Chaobai and Wenyu Rivers flowing through Beijing from the mountains to the west and north. Over the centuries, the builders of Beijing have managed to steer the rivers around the city to prevent flooding, although urban channels still direct Beijing’s refuse their way.