Class: ActiveRecord::ConnectionAdapters::SpatialMysqlColumn

Inherits:
MysqlColumn
  • Object
show all
Includes:
SpatialAdapter::SpatialColumn
Defined in:
lib/spatial_adapter/mysql.rb

Instance Attribute Summary

Attributes included from SpatialAdapter::SpatialColumn

#geometry_type, #srid, #with_m, #with_z

Class Method Summary collapse

Methods included from SpatialAdapter::SpatialColumn

#geographic?, #initialize, #klass, #type_cast, #type_cast_code

Class Method Details

.string_to_geometry(string) ⇒ Object

MySql-specific geometry string parsing. By default, MySql returns geometries in strict wkb format with “0” characters in the first 4 positions.



88
89
90
91
92
93
94
95
# File 'lib/spatial_adapter/mysql.rb', line 88

def self.string_to_geometry(string)
  return string unless string.is_a?(String)
  begin
    GeoRuby::SimpleFeatures::Geometry.from_ewkb(string[4..-1])
  rescue Exception => exception
    nil
  end
end