Class: ActiveRecord::ConnectionAdapters::SpatialPostgreSQLColumn

Inherits:
Column
  • Object
show all
Includes:
SpatialColumn
Defined in:
lib/postgis_adapter.rb

Instance Attribute Summary

Attributes included from SpatialColumn

#geometry_type, #srid, #with_m, #with_z

Class Method Summary collapse

Methods included from SpatialColumn

#initialize, #klass, #type_cast, #type_cast_code

Class Method Details

.create_simplified(name, default, null = true) ⇒ Object



440
441
442
# File 'lib/postgis_adapter.rb', line 440

def self.create_simplified(name,default,null = true)
  new(name,default,"geometry",null,nil,nil,nil)
end

.string_to_geometry(string) ⇒ Object

Transforms a string to a geometry. PostGIS returns a HexEWKB string.



435
436
437
438
# File 'lib/postgis_adapter.rb', line 435

def self.string_to_geometry(string)
  return string unless string.is_a?(String)
  GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(string) rescue nil
end