A Look at “PostGIS In Action”

Over the past few weeks, I have been reading a copy of the upcoming book by Regina Obe and Leo Hsu titled “PostGIS In Action.” Through my work with zigGIS and some of my consulting work with Zekiah, I have been using PostGIS with good results for some time now. I have found that it matches or exceeds the capabilities of its commercial counterparts and I can be quite productive with it.

Regina has been a frequent contributor to zigGIS discussions over the years and her expertise with PostGIS has definitely helped Abe, Paolo and I as we have worked on it. Also, many tips from the Boston GIS blog/site have been very helpful so I have been looking forward to this book for some time.

I must confess to being something of a “book guy.” I like having a book on my lap as I work through a problem (using my multiple monitors for actual implementation). “PostGIS in Action” puts most of what I need between one set of covers.

This book addresses a problem I have run into repeatedly in my consulting work: educating database professionals (DBAs, developers, etc.) on working with spatial data in a manner that they are familiar with. The authors are extremely knowledgeable about database technologies of all kinds and it comes through here.

Since PostGIS extends PostgreSQL, it is impossible to separate the two when discussing good data design and implementation. The “Data Modeling” chapter provides a good discussion of various considerations when working with spatial data (use of complex geometries vs. points, homogeneous vs. heterogeneous geometry columns, etc.) but it also provides one of the best discussions of PostgreSQL table inheritance and partitioning that I have found in one place. Each topic, as throughout the book, is backed up by SQL examples and succinct discussion of the pros and cons of each approach.

The design consideration regarding storing geometry as points versus storing lines or polygons may seem basic to a GIS professional but is a discussion I have had repeatedly throughout my career with database designers who are new to spatial data. Many times, their initial instinct is to store X and Y values in separate columns in a table. This may be a perfectly valid approach for a given data set and how it is to be used but many design considerations come into play. “PostGIS In Action” does a good job of encapsulating those considerations in a manner that is consistent with how most database professionals approach database design.

Another concept that typically confounds database professionals on their first exposure to spatial data is the spatial reference system. “PostGIS In Action” has a chapter dedicated to spatial reference systems. It discusses various common spatial references and their pros and cons as well as the components of a spatial reference (ellipsoid, datum, projection, etc.). This is a complex topic and the purpose of this book is not to “teach GIS” but it is a crucial topic when working with spatial data. The chapter gives a good overview of the concepts and considerations surrounding spatial references. If you are starting to work with spatial data, you will leave the chapter with an understanding of their importance and the fact that you should probably dig into them further.

“PostGIS In Action” continues on to discuss using PostGIS to perform spatial analysis. As always, real SQL samples are used so that a database professional will become comfortable with the use of spatial joins, spatial indexing, the many spatial functions built into PostGIS and many other concepts and techniques. Throughout the book, the authors return to a few examples (the fictional “Hello Town”, San Francisco, Washington, DC) so that each topic is discussed within a problem set with which we become familiar. Additionally, tools such as OGR and QGIS/SPIT are also discussed (with examples).

I could go on but I will summarize what I like about “PostGIS In Action”: it provides a solid foundation for an experienced database professional who needs to begin working with spatial data using PostGIS and PostgreSQL.

Throughout this post, I have used the term “database professional” to describe who I think will benefit from this book. It is not for beginners or the faint of heart. You should be very comfortable with your knowledge of relational databases, SQL and (optionally) PostgreSQL before diving into the book. “PostGIS in Action” does not teach RDBMS basics, nor should it.

From the solid foundation it provides, the book delves into advanced topics and techniques that will enable the reader to become productive with PostGIS. A programmer can also benefit from the practical SQL examples in the book to write better applications (regardless of language) on top of of PostGIS/PostgreSQL. I also think database professionals working on other platforms (such as Oracle/Oracle Spatial) could benefit from the better understanding of the unique characteristics of spatial data that can be achieved with this book. They will also begin to see how well PostgreSQL stacks up against commercial RDBMS platforms in terms of capability.

The subject of spatial data, as well as its implementation in PostGIS, is too big for one book to attempt to handle in a “one-stop shop” manner. “PostGIS In Action” wisely avoids trying to do this. It is a good starting point to begin building expertise if you are new to spatial data and, if you are experienced with it, you will probably learn a few things you didn’t know. I recommend checking out “PostGIS In Action” if you are or will be working with PostGIS or spatial data.

  • http://www.thetimoneygroup.com Brian Timoney


    I bought the pre-release PDF and had a couple of reactions–

    1) This would’ve saved me a TON of time when I was just getting started. Open source technologies can have a long, arduous learning curve and while much can be gleaned by ad hoc googling, one never quite feels that one has the full picture. Getting the whole story in one place plus being exposed to advanced stuff (Voronoi calcs in PostGIS?) is great.

    2) As a proud liberal arts major, the quality of Regina and Leo’s writing has always caught my appreciative eye. So many computer book authors choose to abstract away their human personality and technical topics become even more tedious.

    I’m guest-lecturing next week on the topic of spatial databases and will be strongly urging students to give this book their full attention.


  • http://geobabble.wordpress.com/ Bill Dollins


    I wholeheartedly agree with both of those observations. I had the same reaction as you when I read it. There is just a wealth of good stuff in the book. As for the writing style, it was definitely an easy read. It was nice not to have to fight the text to stay engaged.

    Good luck on your lecture.


  • Pingback: SQL Server 2008 R2, Oracle 11G R2, and PostGIS/PostgreSQL spatial compares | Quantum GIS Information Center()