I'm using RoR with PostGIS to store locations data. I'm trying to store an estimated location using circle (e.g. center point with radius).
I've tried something like that, but it doesn't work:
@location = Location.new(:place_id => place.id,
:circle => %{ST_Buffer(ST_MakePoint(#{latitude}, #{longitude})::geography, #{accuracy})})
I've also tried using RGeo and it's factory but not sure how to use it exactly.
Any help will be appreciated. Thanks.
Edit 1: I made some progress.
factory = RGeo::Cartesian.factory
center_point = factory.point(latitude, longitude)
circle = center_point.buffer(accuracy)
@location = Location.new(:place_id => place.id,
:circle => circle)
BUT - now it throws the following exception:
can't cast RGeo::Cartesian::Polygon Impl to string
Again, any help will be appreciated.