Geo-Rails part 7: Geometry vs. Geography, or, How I Learned To Stop Worrying And Love Projections

This week we’re going to look at how to choose a coordinate system for your database. In PostGIS, this includes the choice of geometry vs geography columns, as well as which projection (if any) to use, and how to interact with it from Rails.

In this article, we’ll:

  • Review geographic and projected coordinate systems
  • Discuss the pros and cons of using the PostGIS geographic type
  • See why I typically store data in a projection
  • Look at some specific projections I recommend using (or avoiding)
  • Learn how to handle projected data in Rails

My original series plan for this week called for a worked example of a location-based web service, bringing together much of the material that we’ve covered so far. But as I was writing it, I realized there was one more topic we probably ought to cover first. So I’ll publish the example next week.

This is part 7 of my continuing series of articles on geospatial programming in Ruby and Rails. For a list of the other installments, please visit http://www.daniel-azuma.com/blog/archives/category/tech/georails.

Continue reading