OS X: postgis columns coming back as String instead of RGeo::Geos datatype

66 views
Skip to first unread message

Denis Haskin

unread,
Jul 31, 2014, 8:05:09 PM7/31/14
to rgeo-...@googlegroups.com
My local OS X rgeo configuration seems to be broken and I'm at a loss for how to fix it: it was working at one point,

First, I'm pretty sure postgis is all working correctly.  E.g. I'm pretty sure this would fail if it wasn't all working correctly:

psql
oneclick_development=# select ST_GeometryType(geom) from counties where id=21000003;
 st_geometrytype
-----------------
 ST_MultiPolygon
(1 row)

but in rails console I get this:

2.1.1 :003 > County.where(id: 21000003).first.geom.class
 => String

On one of our heroku instances where all is working correctly, I get the expected behavior of:

irb(main):002:0> County.where(id: 21000003).first.geom.class
=> RGeo::Geos::CAPIMultiPolygonImpl

I use rvm for ruby and homebrew for libgeos and the other libraries.  I checked where homebrew has geos installed, and uninstalled & reinstalled the gem, with no effect.

$ /usr/local/bin/geos-config --prefix
/usr/local/Cellar/geos/3.4.2
gem install rgeo -- --with-geos-dir=/usr/local/Cellar/geos/3.4.2 --with-proj-dir=/usr/local/Cellar/geos/3.4.2

(and this shouldn't be necessary anyway, libgeos and other libraries are in /usr/local/lib)

I'm quite stumped at the moment.  Suggestions?

Thanks!

Denis Haskin

unread,
Aug 1, 2014, 7:07:46 PM8/1/14
to rgeo-...@googlegroups.com
I should also mention that rgeo reports that it is installed correctly:

2.1.1 :002 > require 'rgeo'
 => false
2.1.1 :003 > RGeo::Geos.supported?
 => true

Denis Haskin

unread,
Aug 1, 2014, 7:21:35 PM8/1/14
to rgeo-...@googlegroups.com
Also: this is the behavior I would expect to see if I was connecting to the db with the postgresql adapter, not the postgis adapter, but that seems correct as well:

2.1.1 :004 > ActiveRecord::Base.connection.class
 => ActiveRecord::ConnectionAdapters::PostGISAdapter::MainAdapter

relevant clause in database.yml:

development: &development
  adapter: postgis
  encoding: unicode
  database: oneclick_development
...etc...

Crystal C

unread,
Aug 19, 2014, 1:51:32 PM8/19/14
to rgeo-...@googlegroups.com
Just curious if you ever found a solution to this?

Denis Haskin

unread,
Aug 19, 2014, 5:17:05 PM8/19/14
to rgeo-...@googlegroups.com
*solution*, no, because unfortunately (well, fortunately for me) it started working again.  I'm at a loss to explain why it started working, because I'm quite sure I didn't change anything.  But obviously I did.

Sorry I'm not more helpful...


--
You received this message because you are subscribed to the Google Groups "RGeo-Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rgeo-users+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages