class OGR::Geometry::EWKBRecord

Parses raw EWKB and turns into a data structure. Only really exists for converting to and from EWKB.

@see trac.osgeo.org/postgis/browser/trunk/doc/ZMSgeoms.txt @see OGR::Geometry::EWKBRecord

Constants

WKB_M
WKB_SRID
WKB_Z

Public Class Methods

from_wkb_record(wkb_record, srid = 0) click to toggle source

@param wkb_record [OGR::Geometry::WKBRecord] @param srid [Fixnum] @return [OGR::Geometry::EWKBRecord]

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 45
def self.from_wkb_record(wkb_record, srid = 0)
  ewkb_type_flag = if srid.zero?
                     wkb_record.wkb_type
                   else
                     (wkb_record.wkb_type | WKB_SRID)
                   end

  ewkb_type_flag |= WKB_Z if wkb_record.has_z?

  new(endianness: wkb_record.endianness,
      wkb_type: ewkb_type_flag,
      srid: srid,
      geometry: wkb_record.geometry)
end

Public Instance Methods

geometry_type() click to toggle source

@return [Fixnum] Enum number that matches the FFI::OGR::Core::WKBGeometryType.

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 76
def geometry_type
  type = wkb_type & 0x0fff_ffff

  has_z? ? (type | WKB_Z) : type
end
has_m?() click to toggle source

@return [Boolean] Is the M flag set?

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 66
def has_m?
  wkb_type & WKB_M != 0
end
has_srid?() click to toggle source

@return [Boolean] Is the SRID flag set?

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 71
def has_srid?
  wkb_type & WKB_SRID != 0
end
has_z?() click to toggle source

@return [Boolean] Is the Z flag set?

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 61
def has_z?
  wkb_type & WKB_Z != 0
end
to_wkb() click to toggle source

@return [String] WKB binary string.

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 88
def to_wkb
  to_wkb_record.to_binary_s
end
to_wkb_record() click to toggle source

@return [OGR::Geometry::WKBRecord]

# File lib/ogr/extensions/geometry/ewkb_record.rb, line 83
def to_wkb_record
  WKBRecord.from_ewkb_record(self)
end