Class: Mongoid::Geospatial::Polygon

Inherits:
GeometryField show all
Defined in:
lib/mongoid_geospatial/wrappers/rgeo.rb,
lib/mongoid_geospatial/fields/polygon.rb,
lib/mongoid_geospatial/wrappers/georuby.rb

Instance Method Summary collapse

Methods inherited from GeometryField

#bounding_box, #center_point, demongoize, #radius, #radius_sphere

Instance Method Details

#to_geoObject



30
31
32
# File 'lib/mongoid_geospatial/wrappers/georuby.rb', line 30

def to_geo
  GeoRuby::SimpleFeatures::Polygon.from_coordinates(self)
end

#to_rgeoObject



35
36
37
38
# File 'lib/mongoid_geospatial/wrappers/rgeo.rb', line 35

def to_rgeo
  ring = RGeo::Geographic.spherical_factory.linear_ring points
  RGeo::Geographic.spherical_factory.polygon ring
end