10 Postgres for geospatial

 

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.

In this chapter, you learn how to use Postgres for geospatial data and workloads. You start by exploring examples of location-based data and the capabilities Postgres offers for working with it. Next, you dive into the PostGIS extension, which enables Postgres to store, query, and process geospatial datasets. Finally, you learn how to expedite the search using GiST indexes. And you do all this the developer way while exploring natural wonders, bustling cities, and world-famous amusement parks located in Florida, the Sunshine State of the United States of America.

10.1 How Postgres works with geodata

10.1.1 Postgres built-in capabilities

10.1.2 Extended capabilities with PostGIS

10.2 Starting Postgres with PostGIS

10.3 Loading OpenStreetMap dataset

10.3.1 Exploring table with points

10.3.2 Exploring table with polygons

10.4 Visualizing geospatial data

10.5 Querying geospatial data

10.5.1 Working with points

10.5.2 Working with polygons

10.5.3 Working with line segments

10.6 Indexing geospatial data

10.6.1 Understanding GiST structure

10.6.2 Using GiST index

10.7 Summary