Buffalo is the second most populous city in the state of New York, second only to New York City. Located in Western New York on the eastern shores of Lake Erie and at the head of the Niagara River, Buffalo is the principal city of the Buffalo-Niagara Falls metropolitan area and the seat of Erie County. The city itself has a population of 292,648 (2000 Census). The Buffalo–Niagara–Cattaraugus Combined Statistical Area is home to 1,254,066 residents. Originating around 1789 as a small trading community near the eponymous Buffalo Creek, Buffalo grew quickly after the opening of the Erie Canal in 1825, with the city as its western terminus. By 1900, Buffalo was the 8th largest city in the country, and went on to become a major railroad hub, the largest grain-milling center in the country, and the home of the largest steel-making operation in the world. The latter part of the 20th Century saw a reversal of fortunes: by the year 1990 the city had fallen back below its 1900 population levels. The rerouting of Great Lakes shipping by the opening of the St. Lawrence Seaway was a factor in the decline of the city. The closing or relocating of many of the steel mills and other heavy industries in the area also contributed to the decline.