Sha256: 8aade36d644b957261066dc6e917c9df50033fe6bdd907637071d6f6c90d2c0c

Contents?: true

Size: 672 Bytes

Versions: 4

Compression:

Stored size: 672 Bytes

Contents

class Armg::WktDeserializer
  DEFAULT_WKB_PARSER_OPTIONS = {
    support_ewkb: true,
  }

  DEFAULT_WKT_GENERATOR_OPTIONS = {
    tag_format: :ewkt,
    #emit_ewkt_srid: true,
  }

  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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
armg-0.7.1 lib/armg/wkt_deserializer.rb
armg-0.7.0 lib/armg/wkt_deserializer.rb
armg-0.6.1 lib/armg/wkt_deserializer.rb
armg-0.6.0 lib/armg/wkt_deserializer.rb