Class: Gdal::Ogr::Layer

Inherits:
Object
  • Object
show all
Defined in:
lib/rgdal/overrides/layer.rb

Instance Method Summary collapse

Instance Method Details

#column_namesObject



22
23
24
# File 'lib/rgdal/overrides/layer.rb', line 22

def column_names
  fields.map(&:name)
end

#featuresObject



7
8
9
10
11
12
# File 'lib/rgdal/overrides/layer.rb', line 7

def features
  [].tap do |array|
    self.each { |feature| array << feature }
    reset_reading
  end
end

#fieldsObject



18
19
20
# File 'lib/rgdal/overrides/layer.rb', line 18

def fields
  definition.get_field_count.times.map { |i| definition.get_field_defn(i) }
end

#fields_hashObject



26
27
28
29
30
31
32
# File 'lib/rgdal/overrides/layer.rb', line 26

def fields_hash
  {}.tap do |hash|
    fields.each do |field|
      hash[field.name] = field.type
    end
  end
end

#to_sObject



14
15
16
# File 'lib/rgdal/overrides/layer.rb', line 14

def to_s
  "#<Gdal::Ogr::Layer name='#{self.get_name}' field_count='#{fields.count}'>"
end