Thursday, December 2, 2010

Importing GNIS into PostgreSQL

The script below will load GNIS National File into PostgreSQL. You can download National File from here (about 280MB uncompressed, main web site). Place the uncompressed file in some directory and run the following script from psql:

The GNIS file has over two million records so it will take some time to load into PostgreSQL. I hope I guessed column types right.

P.S.: GNIS is the "Geographic Names Information System", a product from USGS.