Bangkok is in the Chao Phraya River delta in Thailand's central plain. The river meanders through the city in a southerly direction, emptying into the Gulf of Thailand approximately  south of city centre. The area is flat and low-lying, with an average elevation of  above sea level. Most of the area was originally swampland, which was gradually drained and irrigated for agriculture by the construction of canals (''khlong'') which took place from the 16th to 19th centuries. The course of the river as it flows through Bangkok has been modified by the construction of several shortcut canals.