PostGIS in Action
Regina O. Obe and Leo S. Hsu
Foreword by Paul Ramsey
  • April 2011
  • ISBN 9781935182269
  • 520 pages
  • printed in black & white

From the forward: A concise guide that's truly one of a kind.

Paul Ramsey, Chair, PostGIS Steering Committee


PostGIS in Action, Second Edition is now available. An eBook of this older edition is included at no additional cost when you buy the revised edition!

PostGIS in Action teaches readers of all levels to write spatial queries that solve real-world problems. It first gives you a background in vector-based GIS and then quickly moves into analyzing, viewing, and mapping data. You'll learn how to optimize queries for maximum speed, simplify geometries for greater efficiency, and create custom functions for your own applications. The book covers PostgreSQL 8.4, 9.0, and 9.1 features and shows you how to integrate with other GIS tools.

Table of Contents detailed table of contents




about this book

about the cover illustration

Part 1 Learning PostGIS

1. What is a spatial database?

1.1. Thinking spatially

1.2. Modeling

1.3. Introducing PostgreSQL and PostGIS

1.4. Getting started with PostGIS

1.5. Working with real data

1.6. Using spatial queries to analyze data

1.7. Summary

2. Geometry types

2.1. Geometry columns in PostGIS

2.2. A panoply of geometries

2.3. Summary

3. Organizing spatial data

3.1. Spatial storage approaches

3.2. Modeling a real city

3.3. Using rules and triggers

3.4. Summary

4. Geometry functions

4.1. Constructors

4.2. Outputs

4.3. Accessor functions: getters and setters

4.4. Measurement functions

4.5. Decomposition

4.6. Composition

4.7. Simplification

4.8. Summary

5. Relationships between geometries

5.1. Introducing spatial relationship functions

5.2. Intersections

5.3. Specific intersection relationships

5.4. The remainder: ST_Difference and ST_SymDifference

5.5. Nearest neighbor

5.6. Bounding box and geometry comparators

5.7. The many faces of equality

5.8. Underpinnings of relationship functions

5.9. Summary

6. Spatial reference system considerations

6.1. Spatial reference system: What is it?

6.2. Selecting a spatial reference system to store data

6.3. Determining the spatial reference system of source data

6.4. Summary

7. Working with real data

7.1. Tools for importing/exporting data

7.2. Loading data

7.3. Exporting data from PostGIS

7.4. Summary

Part 2 Putting PostGIS to work

8. Techniques to solve spatial problems

8.1. Proximity analysis

8.2. Data tagging

8.3. Slicing and splicing linestrings

8.4. Slicing and splicing polygons

8.5. Translating, scaling, and rotating geometries

8.6. Summary

9. Performance tuning

9.1. The query planner

9.2. Using explain to diagnose problems

9.3. Indexes and keys

9.4. Common SQL patterns and how they affect performance

9.5. System and function settings

9.6. Optimizing geometries

9.7. Summary

Part 3 Using PostGIS with other tools

10. Enhancing SQL with add-ons

10.1. Georeferencing with the TIGER geocoder

10.2. Solving network routing problems with pgRouting

10.3. Extending PostgreSQL power with PLs

10.4. Graphing and accessing spatial analysis libraries with PL/R

10.5. PL/Python

10.6. Summary

11. Using PostGIS in web applications

11.1. GIS and the web

11.2. Using MapServer

11.3. Using GeoServer

11.4. Basics of OpenLayers and GeoExt

11.5. Displaying data with server-side web scripting

11.6. Summary

12. Using PostGIS in a desktop environment

12.1. At a glance

12.2. OpenJUMP Workbench

12.3. Quantum GIS

12.4. uDig

12.5. gvSIG

12.6. Summary

13. PostGIS raster

13.1. What is PostGIS raster?

13.2. Storing and loading raster data

13.3. Raster maintenance tables and functions

13.4. Commonly used functions

13.5. Combining raster processing with vector processing

13.6. Exporting raster data into other raster formats

13.7. Viewing raster data with MapServer

13.8. The future of PostGIS raster support

13.9. Summary

© 2014 Manning Publications Co.

About the Technology

PostGIS is an open source spatial database extender for PostgreSQL. It equals or surpasses proprietary alternatives, allowing you to create location-aware queries with just a few lines of SQL code, and provides a back-end for mapping applications with minimal effort.

What's inside

  • An introduction to spatial databases
  • Geometry types, functions, and queries
  • Applying PostGIS to real-world problems
  • Extending PostGIS to web and desktop applications

About the reader

Familiarity with relational database concepts is helpful but not required.

About the authors

Regina Obe and Leo Hsu are database consultants. Regina is a member of the PostGIS core development team and the Project Steering Committee. They are hosts of and

An elegant introduction to a difficult domain.

Mark Leslie, LISAsoft Pty Ltd

The ultimate PostGIS tour guide.

Brent Wood, NIWA

Will give you the Aha! moment you've been waiting for.

Jeff Addison, Southgate Software Ltd

Want to get the most out of PostGIS? This is required reading for you.

James Fee,