Module: OGR::Geometry::EWKBIOExtensions

Included in:
OGR::Geometry
Defined in:
lib/ogr/extensions/geometry/ewkb_io_extensions.rb

Overview

Extends OGR::Geometry with methods that allow creating a Geometry from EKWB or outputting a Geometry as EWKB (EWKB is the WKB format that PostGIS uses).

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



29
30
31
# File 'lib/ogr/extensions/geometry/ewkb_io_extensions.rb', line 29

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#to_ewkbString

Returns Binary string representative of EWKB.

Returns:

  • (String)

    Binary string representative of EWKB.



34
35
36
37
38
39
# File 'lib/ogr/extensions/geometry/ewkb_io_extensions.rb', line 34

def to_ewkb
  wkb_record = WKBRecord.read(to_wkb)
  srid = spatial_reference ? spatial_reference.authority_code.to_i : 0

  EWKBRecord.from_wkb_record(wkb_record, srid).to_binary_s
end