Module: RGeo::ActiveRecord::SpatialToPostGISSql

Defined in:
lib/active_record/connection_adapters/cockroachdb/arel_tosql.rb

Overview

Extend rgeo-activerecord visitors to use PostGIS specific functionality

Instance Method Summary collapse

Instance Method Details

#visit_in_spatial_context(node, collector) ⇒ Object



22
23
24
25
26
27
28
29
# File 'lib/active_record/connection_adapters/cockroachdb/arel_tosql.rb', line 22

def visit_in_spatial_context(node, collector)
  # Use ST_GeomFromEWKT for EWKT geometries
  if node.is_a?(String) && node =~ /SRID=[\d+]{0,};/
    collector << "#{st_func('ST_GeomFromEWKT')}(#{quote(node)})"
  else
    super(node, collector)
  end
end