Geo-Rails part 2: Setting Up a Geospatial Rails App

Before going in depth into any particular topic, I thought it would be useful to write a getting-started tutorial, walking through setting up and working with a simple example Rails app using RGeo. In this tutorial, we will:

  • Install the main software components we need for a geospatial application, including a spatial database and the needed Ruby libraries.
  • Set up a new Rails application configured to use the spatial database.
  • Create an ActiveRecord model with a spatial attribute.
  • Experiment with location data in the model.
  • Perform simple spatial queries.

This should help you get started writing basic location features in Rails, giving you a feel for what the tools are and how they fit together.

This is part 2 of my 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

Geo-Rails part 1: A Call To Revolution

It was about a year ago that I released the first public version of RGeo, a geospatial framework for Rails and Ruby applications, along with a bunch of add-on libraries and ActiveRecord adapters designed to work with it.

RGeo has enjoyed some success so far. But over the past year, I’ve fielded a number of questions from folks struggling with it, and I’ve come to realize that it is not very easy to learn or use. A lot of that is my fault. The core RGeo framework is fairly complex, and neither RGeo itself nor its add-on libraries are particularly well documented. Furthermore, geospatial technology is not an easy topic in general. A number of concepts and a fair amount of math has to be understood before you can really get off the ground with a location-aware application beyond the most simple display of a few pushpins on a Google map.

My hope is to start changing that.

For the past few months, I’ve been heads-down on the product releases for Pirq, where I’m the chief architect. But as those projects ease up a bit, I’m going to try to spend more time giving RGeo some love. And as part of that, I’m starting up a series of articles on doing geospatial programming in Ruby and Rails apps, using RGeo.

Continue reading