Module: NoBrainer::GeoQueries::ClassMethods
- Defined in:
- lib/nobrainer_geospatial.rb
Instance Method Summary collapse
Instance Method Details
#intersecting(polygon, options) ⇒ Object
115 116 117 118 119 120 |
# File 'lib/nobrainer_geospatial.rb', line 115 def intersecting(polygon, ) if polygon.class == Array polygon = RethinkDB::RQL.new.polygon(*polygon) end NoBrainer::GeoResultSet.new(self, self.rql_table.get_intersecting(polygon, )) end |
#nearest(point, options) ⇒ Object
107 108 109 110 111 112 113 |
# File 'lib/nobrainer_geospatial.rb', line 107 def nearest(point, ) # if we get an array convert to RQL if point.class == Array point = RethinkDB::RQL.new.point(*point) end NoBrainer::GeoResultSet.new(self, self.rql_table.get_nearest(point, ).map {|result| result['doc'].merge({'_distance' => result['dist']})}) end |