Module: RGeo::ActiveRecord::SpatialToPostGISSql

Defined in:
lib/active_record/connection_adapters/postgis/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



8
9
10
11
12
13
14
15
# File 'lib/active_record/connection_adapters/postgis/arel_tosql.rb', line 8

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