Class: ActiveRecord::ConnectionAdapters::SpatialMysql2Column
- Inherits:
-
Mysql2Column
- Object
- Mysql2Column
- ActiveRecord::ConnectionAdapters::SpatialMysql2Column
- Includes:
- SpatialAdapter::SpatialColumn
- Defined in:
- lib/spatial_adapter/mysql2.rb
Instance Attribute Summary
Attributes included from SpatialAdapter::SpatialColumn
#geometry_type, #srid, #with_m, #with_z
Class Method Summary collapse
-
.string_to_geometry(string) ⇒ Object
MySql-specific geometry string parsing.
Methods included from SpatialAdapter::SpatialColumn
#geographic?, #initialize, #klass, #spatial?, #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.
87 88 89 90 91 92 93 94 |
# File 'lib/spatial_adapter/mysql2.rb', line 87 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 |