Class: OGR::Geometry::EWKBRecord
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- OGR::Geometry::EWKBRecord
- Defined in:
- lib/ogr/extensions/geometry/ewkb_record.rb
Overview
Parses raw EWKB and turns into a data structure. Only really exists for converting to and from EWKB.
Constant Summary collapse
- WKB_Z =
0x8000_0000
- WKB_M =
0x4000_0000
- WKB_SRID =
0x2000_0000
Class Method Summary collapse
Instance Method Summary collapse
-
#geometry_type ⇒ Fixnum
Enum number that matches the FFI::OGR::Core::WKBGeometryType.
-
#has_m? ⇒ Boolean
Is the M flag set?.
-
#has_srid? ⇒ Boolean
Is the SRID flag set?.
-
#has_z? ⇒ Boolean
Is the Z flag set?.
-
#to_wkb ⇒ String
WKB binary string.
- #to_wkb_record ⇒ OGR::Geometry::WKBRecord
Class Method Details
.from_wkb_record(wkb_record, srid = 0) ⇒ OGR::Geometry::EWKBRecord
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# 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 |
Instance Method Details
#geometry_type ⇒ Fixnum
Returns Enum number that matches the FFI::OGR::Core::WKBGeometryType.
76 77 78 79 80 |
# 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? ⇒ Boolean
Returns Is the M flag set?.
66 67 68 |
# File 'lib/ogr/extensions/geometry/ewkb_record.rb', line 66 def has_m? wkb_type & WKB_M != 0 end |
#has_srid? ⇒ Boolean
Returns Is the SRID flag set?.
71 72 73 |
# File 'lib/ogr/extensions/geometry/ewkb_record.rb', line 71 def has_srid? wkb_type & WKB_SRID != 0 end |
#has_z? ⇒ Boolean
Returns Is the Z flag set?.
61 62 63 |
# File 'lib/ogr/extensions/geometry/ewkb_record.rb', line 61 def has_z? wkb_type & WKB_Z != 0 end |
#to_wkb ⇒ String
Returns WKB binary string.
88 89 90 |
# File 'lib/ogr/extensions/geometry/ewkb_record.rb', line 88 def to_wkb to_wkb_record.to_binary_s end |
#to_wkb_record ⇒ OGR::Geometry::WKBRecord
83 84 85 |
# File 'lib/ogr/extensions/geometry/ewkb_record.rb', line 83 def to_wkb_record WKBRecord.from_ewkb_record(self) end |