Sha256: 572d80595210ee38e77c2e6756b4bd1fb83c99c552ae9a2fe0ccab7316057f3b
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
require 'rgeo' require 'mongoid_geospatial/extensions/rgeo_spherical_point_impl' module Mongoid module Geospatial class Point def to_rgeo RGeo::Geographic.spherical_factory.point x, y end def rgeo_distance other to_rgeo.distance other.to_rgeo end end class GeometryField private def points self.map do |pair| RGeo::Geographic.spherical_factory.point(*pair) end end end class Line < GeometryField def to_rgeo RGeo::Geographic.spherical_factory.line_string points end end class Polygon < GeometryField def to_rgeo ring = RGeo::Geographic.spherical_factory.linear_ring points RGeo::Geographic.spherical_factory.polygon ring end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid_geospatial-3.0.0 | lib/mongoid_geospatial/wrappers/rgeo.rb |