class OGR::Layer
Attributes
c_pointer[R]
@return [FFI::Pointer] C pointer to the C Layer
.
Public Class Methods
new(layer_ptr)
click to toggle source
@param layer_ptr [FFI::Pointer]
# File lib/ogr/layer.rb, line 29 def initialize(layer_ptr) @c_pointer = layer_ptr end
Public Instance Methods
extent(force: true)
click to toggle source
@return [OGR::Envelope]
# File lib/ogr/layer.rb, line 72 def extent(force: true) envelope = FFI::OGR::Envelope.new FFI::OGR::API.OGR_L_GetExtent(@c_pointer, envelope, force) return nil if envelope.null? OGR::Envelope.new(envelope) end
extent_by_geometry(geometry_field_index, force: true)
click to toggle source
@return [OGR::Envelope]
# File lib/ogr/layer.rb, line 81 def extent_by_geometry(geometry_field_index, force: true) envelope = FFI::OGR::Envelope.new FFI::OGR::API.OGR_L_GetExtentEx(@c_pointer, geometry_field_index, envelope, force) return nil if envelope.null? OGR::Envelope.new(envelope) end
geometry_type()
click to toggle source
@return [Symbol] One of OGRwkbGeometryType.
# File lib/ogr/layer.rb, line 90 def geometry_type FFI::OGR::API.OGR_L_GetGeomType(@c_pointer) end
name()
click to toggle source
@return [String]
# File lib/ogr/layer.rb, line 34 def name name, ptr = FFI::OGR::API.OGR_L_GetName(@c_pointer) ptr.autorelease = false name end
spatial_reference()
click to toggle source
NOTE: This SpatialReference
is owned by the Layer
and should thus not be modified.
@return [OGR::SpatialReference]
# File lib/ogr/layer.rb, line 64 def spatial_reference spatial_ref_pointer = FFI::OGR::API.OGR_L_GetSpatialRef(@c_pointer) return nil if spatial_ref_pointer.null? OGR::SpatialReference.new(spatial_ref_pointer) end
style_table()
click to toggle source
@return [OGR::StyleTable, nil]
# File lib/ogr/layer.rb, line 95 def style_table style_table_pointer = FFI::OGR::API.OGR_L_GetStyleTable(@c_pointer) return nil if style_table_pointer.null? OGR::StyleTable.new(style_table_pointer) end
style_table=(new_style_table)
click to toggle source
@param new_style_table [OGR::StyleTable, FFI::pointer]
# File lib/ogr/layer.rb, line 103 def style_table=(new_style_table) style_table_ptr = GDAL._pointer(OGR::StyleTable, new_style_table) raise OGR::Failure if style_table_ptr.nil? || style_table_ptr.null? FFI::OGR::API.OGR_L_SetStyleTable(@c_pointer, style_table_ptr) end
sync_to_disk()
click to toggle source
@return [Boolean] TODO: This seems to occasionally lead to: 28352 illegal hardware
instruction, and sometimes full crashes.
# File lib/ogr/layer.rb, line 44 def sync_to_disk OGR::ErrorHandling.handle_ogr_err("Unable to sync layer to disk") do FFI::OGR::API.OGR_L_SyncToDisk(@c_pointer) end end
test_capability(capability)
click to toggle source
Tests if this layer supports the given capability. Must be in the list of available capabilities. See www.gdal.org/ogr__api_8h.html#a480adc8b839b04597f49583371d366fd.
@param capability [String] @return [Boolean] @see www.gdal.org/ogr__api_8h.html#a480adc8b839b04597f49583371d366fd
# File lib/ogr/layer.rb, line 56 def test_capability(capability) FFI::OGR::API.OGR_L_TestCapability(@c_pointer, capability.to_s) end