我想保存一个多边形。
这是Geojson
enter link description here
str1 = "geojson....."
geom = RGeo::GeoJSON.decode(str1, json_parser: :json)
l = Limit.new
l.multipoligono = geom
l.save
NoMethodError: undefined methodfactory' for #RGeo::GeoJSON::FeatureCollection:0x3fc7febb7424`
RGeo::ActiveRecord::SpatialFactoryStore.instance.tap do |config|
config.default = RGeo::Geos.factory_generator
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "point")
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "multi_polygon")
config.register(RGeo::Geographic.spherical_factory(srid: 4326), geo_type: "geometry_collection")
end