Sunday, March 20, 2011

How-To: Spatial and Ruby on OSX

Notes on getting started using Ruby and rgeo on OSX to manipulate spatial data. 

1. Download and install ruby 1.92
$ curl -o ruby-1.9.2-p180.tar.gz 
$ tar xvfz ruby-1.9.2-p180.tar.gz
$ cd ruby-1.9.2-p180
$ ./configure
$ make
$ sudo make install
2. Download and install homebrew package manager
$ ruby -e "$(curl -fsSLk"
3. Download and install geos and proj libraries. The ruby gem rgeo requires geos and proj. While it is possible to build rgeo against  the Kyng Chaos Frameworks, it's far easier to install these libraries using brew.
$ brew install geos
$ brew intall proj
4. Install rgeo. RGeo is a ruby gem based on the OGC Simple Features Specification.
$ sudo gem install rgeo
5. Install supporting rgeo gems.
$ sudo gem install dbf
$ sudo gem install rgeo-shapefile
$ gem install pg
$ gem install rgeo-activerecord
$ gem install activerecord-postgis-adapter
$ gem install rgeo-geojson

No comments:

Post a Comment