Module: RGeo::ActiveRecord

Defined in:
lib/rgeo/active_record/version.rb,
lib/rgeo/active_record/geometry_mixin.rb,
lib/rgeo/active_record/spatial_expressions.rb,
lib/rgeo/active_record/arel_spatial_queries.rb,
lib/rgeo/active_record/spatial_factory_store.rb,
lib/rgeo/active_record/common_adapter_elements.rb

Defined Under Namespace

Modules: GeometryMixin, SpatialExpressions, SpatialToSql Classes: SpatialConstantNode, SpatialFactoryStore, SpatialIndexDefinition, SpatialNamedFunction

Constant Summary collapse

VERSION =
"4.0.0".freeze
DEFAULT_SPATIAL_COLUMN_CONSTRUCTORS =

Some default column constructors specifications for most spatial databases. Individual adapters may add to or override this list.

{
  spatial:             { :type => 'geometry' }.freeze,
  geometry:            {}.freeze,
  point:               {}.freeze,
  line_string:         {}.freeze,
  polygon:             {}.freeze,
  geometry_collection: {}.freeze,
  multi_line_string:   {}.freeze,
  multi_point:         {}.freeze,
  multi_polygon:       {}.freeze,
}.freeze

Class Method Summary collapse

Class Method Details

.geometric_type_from_name(name) ⇒ Object

Returns a feature type module given a string type.


27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rgeo/active_record/common_adapter_elements.rb', line 27

def self.geometric_type_from_name(name)
  case name.to_s
  when /^geometry/i then ::RGeo::Feature::Geometry
  when /^point/i then ::RGeo::Feature::Point
  when /^linestring/i then ::RGeo::Feature::LineString
  when /^polygon/i then ::RGeo::Feature::Polygon
  when /^geometrycollection/i then ::RGeo::Feature::GeometryCollection
  when /^multipoint/i then ::RGeo::Feature::MultiPoint
  when /^multilinestring/i then ::RGeo::Feature::MultiLineString
  when /^multipolygon/i then ::RGeo::Feature::MultiPolygon
  else nil
  end
end

.spatial_expressions_supported?Boolean

Returns true if spatial expressions (i.e. the methods in the SpatialExpressions module) are supported.

Returns:

  • (Boolean)

5
6
7
# File 'lib/rgeo/active_record/spatial_expressions.rb', line 5

def self.spatial_expressions_supported?
  defined?(::Arel::Nodes::NamedFunction)
end