5

I am new to working with geospatial datam and am working with the Rails RGeo gem. I am getting the following error in my rails console:

> geo_shape = ES_Zone::FACTORY.parse_wkt
RGeo::Error::UnsupportedOperation: Proj4 is not supported because the proj4 library was not found at install time.

When I test to see if proj4 is supported, it predictably comes back as false.

> RGeo::CoordSys::Proj4.supported?
=> false 

I googled the error message, but I cannot find any resources for this particular problem. Any ideas?

dmanaster
  • 579
  • 1
  • 6
  • 16
  • Did you have the Proj4 library installed when you installed the RGeo gem? If so, which directory was it in? –  May 23 '14 at 19:20
  • I did not know that this existed as a separate library until I got this error message. Is this the library that you mean? http://trac.osgeo.org/proj/ – dmanaster May 23 '14 at 19:55

1 Answers1

6

As the error says, the Proj4 library was not installed during installation of the RGeo gem.

By default RGeo expects the Proj4 library to be in one of the following directories:

/usr/local
/usr/local/proj
/usr/local/proj4
/opt/local
/opt/proj
/opt/proj4
/opt
/usr
/Library/Frameworks/PROJ.framework/unix

If you install it somewhere else you need to install the RGeo gem with the option --with-proj-dir=/path/to/proj4/directory.

I suggest you gem uninstall rgeo, install Proj4 to one of the default directories and then gem install rgeo again.

You can find the error message you received at the top of the projected_factory method of lib/rgeo/geographic/interface.rb. RGeo::CoordSys::Proj4.supported? in turn looks for the presence of a _create method. This is defined by a C routine based on the installation of the Proj4 library, which is why the library needs to be present during installation of the gem and can't just be added later.

  • 2
    There's [a few other places this looks now](https://github.com/rgeo/rgeo/blob/master/ext/geos_c_impl/extconf.rb) including `/usr/lib64`. – tadman Sep 10 '14 at 21:50