ruby on rails - activerecord_postgis_adapter: undefined method `point' for nil:NilClass -


problem

90% sure it's setup error on end, can't self.factory , trying access lonlat gives me exception "undefined method `point' nil:nilclass"

i can

set lonlat using:

mfactory = rgeo::activerecord::spatialfactorystore.instance.factory(:geo_type => 'point') self.lonlat = mfactory.point(long, lat) self.save 

this gives me values 0101000020e610000061c3d32b65965dc03657cd7344f64040 in db.

i can't use:

self.lonlat = "point(#{long},#{lat})" self.save 

questions

do need setup specific in model?

i created github issue less consise more detailed explaination.

rgeos depends on geos. error result of rgeos not being able load geos.

to check if issue:

$ rails c > rgeo::geos.supported? => false 

to check if have geos installed:

geos-config --version 

if geos isn't installed:

brew install geos 

if geos installed, fix installed rgeo:

$ geos-config --prefix /usr/local/cellar/geos/3.5.0 $ gem install rgeo -- --with-geos-dir=/usr/local/cellar/geos/3.5.0 

should installed correctly , errors fixed. can check did above:

$ rails c > rgeo::geos.supported? => true 

if doesn't work uninstall versions of geos , rgeo:

$ brew uninstall geos $ gem uninstall rgeo 

re-install geos , rgeo instructed above. should have gem 'rgeo' in gemfile , after bundle, should see 1 of outputs: "installing rgeo 0.4.0 native extensions"


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -