nofxx / georuby

This is intended as a holder for geometric data. The data model roughly follows the OGC.
MIT License
245 stars 55 forks source link

can't convert String into Float #1

Closed donpdonp closed 13 years ago

donpdonp commented 13 years ago

Since you were so quick to help before, i hope you dont mind another issue :). ive looked at the GeoRuby code in the backtrace and i'm a bit lost. I also hope this is enough information to be useful. `

Location.create({:user_id=>51,"latitude"=>"45.51163136959076", "longitude"=>"-122.61863350868225", "altitude"=>"37.0", "accuracy"=>"16.0", "heading"=>"0.0", "velocity"=>"0.0", "timestamp"=>"2010-10-12T21:53:07+0000", "batterylevel"=>"43"}).errors.full_messages TypeError: can't convert String into Float from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/point.rb:133:in pack' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/point.rb:133:inbinary_representation' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/geometry.rb:66:in as_ewkb' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/GeoRuby-1.3.4/lib/geo_ruby/simple_features/geometry.rb:76:inas_hex_ewkb' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/postgis_adapter-0.7.8/lib/postgis_adapter.rb:114:in quote' from /usr/local/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/activerecord-2.3.8/lib/active_record/base.rb:3033:inblock in attributes_with_quotes' `

donpdonp commented 13 years ago

i should add that the Location model has these helpers to make the #create call work.

def longitude=(new_longitude); geom_assign(:x, new_longitude); end def latitude=(new_latitude); geom_assign(:y, new_latitude); end def altitude=(new_altitude); geom_assign(:z, new_altitude); end

donpdonp commented 13 years ago

the fix may be blindingly obvious. im trying geom_assign(:x, new_longitude.to_f) with success so far.

donpdonp commented 13 years ago

that was it. i guess this changed in GeoRuby.