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?
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.