class GeoRuby::GeoJSONFeature

Class added to support geojson ‘Feature’ objects

Attributes

geometry[RW]
id[RW]
properties[RW]

Public Class Methods

new(geometry, properties = {}, id = nil) click to toggle source
# File lib/geo_ruby/geojson.rb, line 19
def initialize(geometry, properties = {}, id = nil)
  @geometry = geometry
  @properties = properties
  @id = id
end

Public Instance Methods

==(other) click to toggle source
# File lib/geo_ruby/geojson.rb, line 25
def ==(other)
  if (self.class != other.class)
    false
  else
    (id == other.id) &&
      (geometry == other.geometry) &&
      (properties == other.properties)
  end
end
as_geojson(options = {})
Alias for: to_json
to_json(options = {}) click to toggle source
# File lib/geo_ruby/geojson.rb, line 35
def to_json(options = {})
  output = {}
  output[:type] = 'Feature'
  output[:geometry] = geometry
  output[:properties] = properties
  output[:id] = id unless id.nil?
  output.to_json(options)
end
Also aliased as: as_geojson