polygon = RGeo::Geographic.spherical_factory.parse_wkt(params[:polygon])
works for me! I am using rails + mysql
At first I tried to create a place entry in Rails as follows:
@place = Place.new(params)
Btw, my places table is as follows:
`polygon` polygon DEFAULT NULL,
`latlon` point DEFAULT NULL,
, , rgeo latlon mysql, . latlon, . place.rb
self.rgeo_factory_generator = RGeo::Geos.method(:factory)
set_rgeo_factory_for_column(:latlon, RGeo::Geographic.spherical_factory)
set_rgeo_factory_for_column(:polygon, RGeo::Geographic.spherical_factory)
, .
rgeo/reographic/interface.rb
OK. . , .
polygon = RGeo::Geographic.spherical_factory.parse_wkt(params[:polygon])
params[:polygon] = polygon
@place = Place.new(place_params)
@place.save
!
polygon = RGeo::Geographic.spherical_factory.parse_wkt(params[:polygon])
@place.polygon = polygon
@place.save
, , , ActiveRecord !