class Armg::WktDeserializer

Constants

DEFAULT_WKB_PARSER_OPTIONS
DEFAULT_WKT_GENERATOR_OPTIONS

Public Class Methods

new(factory: nil, wkb_parser_options: {}, wkt_generator_options: {}) click to toggle source
# File lib/armg/wkt_deserializer.rb, line 14
def initialize(factory: nil, wkb_parser_options: {}, wkt_generator_options: {})
  @wkb_parser = RGeo::WKRep::WKBParser.new(
    factory,
    DEFAULT_WKB_PARSER_OPTIONS.merge(wkb_parser_options)
  )
  @wkt_generator = RGeo::WKRep::WKTGenerator.new(
    DEFAULT_WKT_GENERATOR_OPTIONS.merge(wkt_generator_options)
  )
end

Public Instance Methods

deserialize(mysql_geometry) click to toggle source
# File lib/armg/wkt_deserializer.rb, line 24
def deserialize(mysql_geometry)
  wkb = Armg::Utils.mysql_geometry_to_wkb(mysql_geometry)
  obj = @wkb_parser.parse(wkb)
  @wkt_generator.generate(obj)
end