1 What is a spatial database?


This chapter covers

  • Spatial databases in problem solving
  • Spatial data types
  • Modeling with spatial in mind
  • Why you might use PostGIS/PostgreSQL for a spatial database
  • Loading and querying spatial data

Most folks experience their first spatially enabled application when they see pushpins tacked onto points of interest on an interactive map. This provides a glimpse into the vast and varied field of geographic information systems (GIS).

We’ll begin this chapter with a pushpin model. As we demonstrate its limited usefulness, we’ll introduce the need for a spatial database—not just any database, but PostGIS. PostGIS is a spatial database extender for the PostgreSQL database management system. We’ll provide a brief introduction to the entire PostGIS suite and whet your appetite with an example that goes far beyond what you can accomplish with pushpins.

The data and code used in this chapter can be found at www.postgis.us/chapter_01_edition_3.

1.1 Thinking spatially

1.2 Introducing PostGIS

1.2.1 Why PostGIS

1.2.2 Standards conformance

1.2.3 PostGIS is powerful

1.2.4 Built on top of PostgreSQL

1.2.5 Free—as in money

1.2.6 Free—as in freedom

1.2.7 Alternatives to PostGIS

1.3 Installing PostGIS

1.3.1 Verifying versions of PostGIS and PostgreSQL

1.4 Spatial data types

1.4.1 Geometry type

1.4.2 Geography type

1.4.3 Raster type

1.4.4 Topology type

1.5 Hello real world