Class: OGR::GeometryExtensions::EWKBRecord
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- OGR::GeometryExtensions::EWKBRecord
- Defined in:
- lib/ogr/geometry_extensions/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::GeometryExtensions::WKBRecord
Class Method Details
.from_wkb_record(wkb_record, srid = 0) ⇒ OGR::GeometryExtensions::EWKBRecord
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 42 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.
73 74 75 76 77 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 73 def geometry_type type = wkb_type & 0x0fff_ffff has_z? ? (type | WKB_Z) : type end |
#has_m? ⇒ Boolean
Returns Is the M flag set?.
63 64 65 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 63 def has_m? wkb_type & WKB_M != 0 end |
#has_srid? ⇒ Boolean
Returns Is the SRID flag set?.
68 69 70 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 68 def has_srid? wkb_type & WKB_SRID != 0 end |
#has_z? ⇒ Boolean
Returns Is the Z flag set?.
58 59 60 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 58 def has_z? wkb_type & WKB_Z != 0 end |
#to_wkb ⇒ String
Returns WKB binary string.
85 86 87 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 85 def to_wkb to_wkb_record.to_binary_s end |
#to_wkb_record ⇒ OGR::GeometryExtensions::WKBRecord
80 81 82 |
# File 'lib/ogr/geometry_extensions/ewkb_record.rb', line 80 def to_wkb_record WKBRecord.from_ewkb_record(self) end |