obe_cover150.jpgI was recently asked to review a soon to be published book on PostGIS, a spatial extension to the very popular Postgresql relational database. I was very excited about receiving an early copy of this book, as the authors have provided countless tips, fixes, and clever query examples on the PostGIS mailing list over the years. After spending a couple weeks looking through the book, I have to say that I am very impressed with the quality and completeness. Indeed, this is the book that I wish would have been available when I was starting out with PostGIS. The authors do an excellent job of promoting the idea that a relational database and SQL are well suited for spatial data modeling and analysis.

  • Book Information
    Authors: Regina O. Obe and Leo S. Hsu
    Publisher: Manning
    Softbound print: Summer 2010 | 425 pages
    ISBN: 9781935182269
    Price: $29.99 for the eBook, $49.99 for printed copy + eBook
  • Intended Audience
    This book has something for everyone. Beginners will likely benefit the most from the clear, example-based demonstration of RDBMS and spatial SQL concepts. The task-oriented nature of most sections should offer an excellent resource to intermediate-level users. I initially thought that this book, although very good, wouldn't be of much use to experienced PostGIS users-- as it starts out at a level suitable for a beginner to relational database and spatial data handling. However, after the first couple of chapters I quickly realized that Obe and Hsu were going through some very high-level examples. This book would serve as an excellent reference for those individuals who are pros at PL/PGSQL and all things spatial.
  • Content Summary
    • Introduction to Spatial Data and SQL (50%)
      Highlights from these chapters include a thorough introduction to spatial reference systems (SRS) and coordinate system conversions. For users that are new to spatial data, the importance of this material cannot be overstated. A very accessible introduction to the Postgresql database and concepts of spatial SQL follows. The sections on geometry primitives used by PostGIS and common data modeling strategies are probably most interesting to new users, however, there is enough detail in the extended discussion that will interest medium to advanced users. I plan on revisiting the discussion on spatial data modeling as a regular practice before starting new projects involving PostGIS. The recently added chapter on the WKT Raster support in PostGIS is one of the best descriptions of this very new technology. Although it is a work in progress, the incorporation of raster data into a PostGIS database will make it possible to automate an entirely new suite of analyses via the SQL language.
    • Applied Examples (15%)
      This and the following chapters were my favorite. I am constantly faced with the limitations of basic SQL when working with soils data. Several queries "chained together" usually get the job done, but the approach doesn't scale well with repetitive operations. Writing custom functions in PL/PGSQL is one solution, however I have yet to find a good tutorial on the subject. This section of the book contains numerous examples that combine the basics of PL/PGSQL with PostGIS-centric spatial functions. I am looking forward to spending some quality time with this material so that I can finally convert needlessly repetitive queries into reusable PL/PGSQL functions.
    • Integration with other Tools (15%)
      The topics covered in this section of the book would probably answer many of the questions that get posted to the PostGIS mailing list; "how can I implement geocoding?", "how is routing accomplished?", "how can I write PL functions in other languages?", and "what software is available for interacting with query results?". Just as with PL/PGSQL documentation and examples, there are very few good demonstrations of how to write PL/* functions in perl, python, and especially R. Interfacing PL/* functions with R opens up many very interesting possibilities both spatial and non-spatial. For example, massive point datasets are usually depicted as clusters at small map scales. Generating cluster centers, bounding polygons, or some kind of central marker is a non-trivial effort. However, it shouldn't be too difficult write a simple R-based aggregate function that accepts coordinates (along with any other clustering criteria) to one of the many algorithms available in R, and returns cluster centroids and a list of IDs linking the original points to the new clusters.
    • Appendix Material (15%)
      The appendix material within this book is surprisingly comprehensive. Appendix A contains a very large collection of links related to online reference material, mailing lists, PostGIS-related blog sites, presentations, and tutorials. Although many of these sites aren't necessarily as complete a reference as the book, they often contain demonstrations of how to accomplish highly specialized tasks using PostGIS. Also included are sources of publicly available geographic data. Appendix B should contain everything that a new user would need to get an installation of PostGIS up and running. In addition, there is a nice discussion on the many routes in which an installation can be upgraded-- and potential caveats associated with each method. Having this material available would have definitely saved me from several botched upgrade attempts when I started using PostGIS for serious work. Instructions are presented within the context both command-line interfaces (Linux or Mac OS X) and the Windows GUI. Appendix C is probably one of the best SQL primers I have ever seen, full of examples, discussion, figures demonstrating SQL concepts-- and all of it condensed into about 25 pages. A PDF version of this section alone would be worth distributing as some kind of instructional pamphlet. Finally, Appendix D contains a detailed summary of ways in which PostGIS can be optimized, through server configuration, smart indexing, and adjustments to common queries.
  • Points of Interest
    This book is based on cutting-edge material: PostgreSQL 8.4, PostGIS 1.5, WKT raster, etc. SQL examples are presented with a unique use of inline labels that help to bridge example to subsequent discussion. Examples. There are hundreds of SQL snippets in this book that do a great job demonstrating how SQL, spatial SQL, and PL/* functions work.
  • Concluding Remarks
    Excellent. The quantity of information and quality of examples within this book fill a long-standing gap in knowledge related to PostGIS and the more general topic of spatial SQL.