When people speak of a learning curve in geospatial programming, they’re usually referring to handling coordinate systems. It’s true that many spatial applications require close attention to the coordinate system, and it’s true that there are some difficult concepts involved. However, it’s been my experience that once the light bulb turns on, it opens up a lot of the power and potential of geodata.
In this article, we’ll take a first look at coordinate systems and geographic projections. We will:
- Examine the importance and effect of coordinate system differences
- Survey the various coordinate systems used for geospatial data
- Become familiar with coordinate system representations and SRIDs
- Specify coordinate systems in RGeo factories
- Use RGeo to convert data between coordinate systems
- Learn how to handle coordinate systems in Rails
This is part 4 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.
RGeo is a library and framework for handling spatial data in a Ruby application. It’s currently designed more for completeness than ease of use, so there’s a bit of an initial learning curve. This article is an attempt to smooth that learning curve a bit. It contains a tutorial introduction to RGeo, covering the basics that every RGeo user needs to know, and a bit of discussion of where the library came from. Included is:
- An introduction to the industry standard spatial data types
- Working with spatial data objects in RGeo
- Factories: why RGeo uses them and what they’re for
- A comparison with GeoRuby
- A guide to the RDocs
RGeo includes a number of advanced features which I’ll cover in future articles. But for now, I think these are the important topics that will get you started.
This is part 3 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.
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.
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.
At GeoPage, we’ve been doing location-aware and geospatial applications using Rails for several years now. I’m pleased to announce that we’ve released one of our core components, the RGeo library, under a liberal BSD-style license. This library should be very useful for developers working with location data in a Rails application.
What is RGeo?
RGeo is, at its heart, a representation of spatial vector data in Ruby. It implements the industry standard OGC Simple Feature Access Specification, providing classes for points, lines, polygons, and other geometric objects, as well as a full set of geometric operations such as finding intersections, creating buffers, calculating distances, etc. It also provides the tools needed to work with geographic coordinate systems and projections, and to read and write data in the well-known formats understood by spatial databases. Continue reading
I’m switching my blog to WordPress. Some older posts will not be available for a few days while I move them over. The rest of my website will also not be available for a few days because I’m in the process of porting it to Rails 3.
Summary: Introducing Versionomy, a new rubygem offering robust parsing, interpretation, manipulation, and comparison of version numbers. It features an adaptive parser with enough flexibility to handle a variety of syntaxes, including prerelease (e.g. alpha, beta) syntax, patchlevels, and nonstandard delimiters. Try it out and feel free to leave feedback. Continue reading
I just spent most of a day tracking down a rather obscure Ruby interpreter bug involving multiple threads calling IO#select. Basically, what happens is, if you are running Ruby 1.8.7p160 through 1.8.7p174 (and possibly some later versions), and you have multiple threads calling IO#select on different and disjoint sets of IO objects, the calls may fail to return results even though there are results to return. Continue reading