Learning database tools means working with data, so we need to cover that aspect first. There are many ways of importing data to PgSQL/PostGIS; some are more database-specific, some are PostGIS-specific, and some use external tools. To complicate things a bit more, quite often real-world data import processes are wrapped into programs that perform different tasks and ops in order to maintain the data quality and integrity when importing it. The key though is that even very complex import tools usually use simpler procedures or commands in order to achieve their goals.
Such simple import procedures are described in this chapter. We specifically focus on:
- Importing flat data through both psql and pgAdmin and extracting spatial information from flat data
- Importing shape files using shp2pgsql
- Importing vector data using ogr2ogr
- Importing vector data using GIS clients
- Importing OpenStreetMap data
- Connecting to external data sources with data wrappers
- Loading rasters using raster2pgsql
- Importing data with pgrestore