Class: Armg::WkbDeserializer

Inherits:
Object
  • Object
show all
Defined in:
lib/armg/wkb_deserializer.rb

Constant Summary collapse

DEFAULT_OPTIONS =
{
  support_ewkb: true
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(factory: nil, **options) ⇒ WkbDeserializer

Returns a new instance of WkbDeserializer.



9
10
11
12
# File 'lib/armg/wkb_deserializer.rb', line 9

def initialize(factory: nil, **options)
  options = DEFAULT_OPTIONS.merge(options)
  @wkb_parser = RGeo::WKRep::WKBParser.new(factory, options)
end

Instance Method Details

#deserialize(mysql_geometry) ⇒ Object



14
15
16
17
# File 'lib/armg/wkb_deserializer.rb', line 14

def deserialize(mysql_geometry)
  wkb = Armg::Utils.mysql_geometry_to_wkb(mysql_geometry)
  @wkb_parser.parse(wkb)
end