I am using RoR with PostGIS to store location data. I am trying to save a calculated location with a circle (e.g. a center point with a radius).
I tried something like this, but it does not work:
@location = Location.new(:place_id => place.id, :circle => %{ST_Buffer(ST_MakePoint(#{latitude}, #{longitude})::geography, #{accuracy})})
I also tried using RGeo and factory, but don't know how to use it.
Any help would 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 this raises the following exception:
can't cast RGeo::Cartesian::Polygon Impl to string
Again, any help would be appreciated.
source share