10 Postgres for geospatial data
This chapter covers
- Exploring Postgres capabilities for geospatial workloads
- Using the PostGIS extension to store and query location-based data
- Visualizing geographic information with the QGIS tool
- Optimizing the search with spatial indexes
Spatial data refers to information that represents the position and shape of objects in geometric space. Examples include points, lines, and polygons defined in two- or three-dimensional Euclidean space. Geospatial data is a subset of spatial data that specifically refers to geographic information (geodata) associated with locations on the Earth’s surface. Think of the physical location of a car, or the size and position of a thunderstorm, expressed in latitude and longitude coordinates.
Let’s explore how to use Postgres for geospatial data and workloads as we work with an OpenStreetMaps dataset for Florida, the Sunshine State of the United States of America. We’ll learn how to store, query, and process the geodata in Postgres while exploring natural wonders, bustling cities, and world-famous amusement parks across Florida.
10.1 How Postgres works with geodata
Geospatial data stores the location and additional information about an object on the planet’s surface. The stored data can be static, dynamic, or even temporal in nature, depending on whether the position or other attributes of the object change.