module RPClustering::RGeo::ActiveRecord::ArelAttributeSpatialExpressions
Spatial Expressions to be attached directly to Arel Attributes (DB columns)
Public Instance Methods
st_collect()
click to toggle source
ST_Collect: www.postgis.org/docs/ST_Collect.html
Implements postgis function variant:
geometry ST_Collect(geometry[] g1_array);
Returns a geometry collection
# File lib/rp_clustering-rgeo-activerecord/arel_attribute_spatial_expressions.rb, line 51 def st_collect() args = [self] ::RGeo::ActiveRecord::SpatialNamedFunction.new( 'ST_Collect', args, [true, true] ) end
st_minimumboundingcircle(num_segs=nil)
click to toggle source
ST_MinimumBoundingCircle: www.postgis.org/docs/ST_MinimumBoundingCircle.html
Implements postgis function variant:
geometry ST_MinimumBoundingCircle(geometry geomA, integer num_segs_per_qt_circ=48);
Returns a geometry
# File lib/rp_clustering-rgeo-activerecord/arel_attribute_spatial_expressions.rb, line 68 def st_minimumboundingcircle(num_segs=nil) args = [self] spatial_flags = [true, true] if num_segs args << num_segs.to_s spatial_flags << false end ::RGeo::ActiveRecord::SpatialNamedFunction.new( 'ST_MinimumBoundingCircle', args, spatial_flags ) end
st_snaptogrid(grid_size)
click to toggle source
ST_SnapToGrid: www.postgis.org/docs/ST_SnapToGrid.html
Implements postgis function variant:
geometry ST_SnapToGrid(geometry geomA, float size);
Returns a geometry collection
# File lib/rp_clustering-rgeo-activerecord/arel_attribute_spatial_expressions.rb, line 19 def st_snaptogrid(grid_size) args = [self, grid_size.to_s] # SpatialNamedFunction takes the following args: # * name # * expr # * spatial_flags # * aliaz (defaults to nil) # # # Understanding the spatial_flags argument # ----------------------------------------- # # A flag is true if the corresponding argument is spatial, else the # flag is false. # The first element is the spatial-ness result, the other args # relate to our expression args ::RGeo::ActiveRecord::SpatialNamedFunction.new( 'ST_SnapToGrid', args, [true, true, false] ) end