3

I am having a little trouble getting my Ruby on Rails app to recognise the GEOS installation on Ubuntu 14.04.

The error message that I am getting is;

GEOS is not available, but is required for correct interpretation of polygons in shapefiles.

I'm using the 'rgeo' gem and I understand this to mean (from my own Googling) that rgeo can't find the GEOS installation.

Indeed, via the Rails console, this is confirmed;

Loading production environment (Rails 4.2.1)
2.1.2 :001 > RGeo::Geos.supported?
 => false 
2.1.2 :002 > RGeo::CoordSys::Proj4.supported?
 => true 

I initially followed these instructions to get GEOS / Proj4 installed;

https://gist.github.com/robinkraft/2a8ee4dd7e9ee9126030

When that didn't work I found this post;

https://github.com/rgeo/rgeo/issues/26

And added the recommended symlinks;

-rw-r--r-- 1 root root 1588288 Apr  7  2014 /usr/lib/libgeos-3.4.2.so
-rw-r--r-- 1 root root  259680 Apr  7  2014 /usr/lib/libgeos_c.a
lrwxrwxrwx 1 root root      18 Apr  7  2014 /usr/lib/libgeos_c.so ->     libgeos_c.so.1.8.2
lrwxrwxrwx 1 root root      18 Apr  7  2014 /usr/lib/libgeos_c.so.1 -> libgeos_c.so.1.8.2
-rw-r--r-- 1 root root  146632 Apr  7  2014 /usr/lib/libgeos_c.so.1.8.2
lrwxrwxrwx 1 root root      31 Jul  4 11:30 /usr/lib/libgeos.so -> /usr/local/lib/libgeos-3.3.8.so
lrwxrwxrwx 1 root root      31 Jul  4 11:35 /usr/lib/libgeos.so.1 -> /usr/local/lib/libgeos-3.3.8.so

And despite all of this I still get

RGeo::Geos.supported?

returning 'false'.

I get the feeling that this shouldn't be this hard (and that I am missing something elementary) - but am at a bit of a loss.

Any help would be greatly appreciated. :)

Thanks in advance, Ben

benjimix
  • 609
  • 7
  • 18

1 Answers1

0

This worked fine for me :

sudo aptitude install libgeos-dev
gem install rgeo
Eric Duminil
  • 52,989
  • 9
  • 71
  • 124