Sha256: d8bccb4600297130992a4f5fd7bfabcd555de00cd8e725ec6d2308580c7482e6

Contents?: true

Size: 568 Bytes

Versions: 2

Compression:

Stored size: 568 Bytes

Contents

require 'json'

module OGR
  module FeatureExtensions

    # @return [Array<OGR::Field>]
    def fields
      0.upto(field_count - 1).map do |i|
        field(i)
      end
    end

    # @return [Hash]
    def as_json
      {
        definition: definition,
        fid: fid,
        field_count: field_count,
        fields: fields.map(&:as_json),
        geometry: geometry.as_json,
        geometry_field_count: geometry_field_count,
        style_string: style_string
      }
    end

    # @return [String]
    def to_json
      as_json.to_json
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta3 lib/ogr/feature_extensions.rb
ffi-gdal-1.0.0.beta1 lib/ogr/feature_extensions.rb