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



405
406
407
# File 'lib/postgis_adapter.rb', line 405

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.



400
401
402
403
# File 'lib/postgis_adapter.rb', line 400

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