Class: CloudMade::GeoResult

Inherits:
Object
  • Object
show all
Defined in:
lib/geocoding.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ GeoResult

Returns a new instance of GeoResult.



126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/geocoding.rb', line 126

def initialize(data)
  self.id = data['id']
  self.geometry = CloudMade::Geometry.parse(data['geometry'])
  self.centroid = CloudMade::Geometry.parse(data['centroid'])
  self.bounds = CloudMade::BBox.from_coordinates(data['bounds']) if data.has_key? 'bounds'
  self.properties = data['properties']
  if data.has_key? 'location'
    self.location = Location.new(data['location'])
  else
    self.location = nil
  end
end

Instance Attribute Details

#boundsObject

Bounds of result set



120
121
122
# File 'lib/geocoding.rb', line 120

def bounds
  @bounds
end

#centroidObject

Centroid of the object



118
119
120
# File 'lib/geocoding.rb', line 118

def centroid
  @centroid
end

#geometryObject

Geometry of the object



116
117
118
# File 'lib/geocoding.rb', line 116

def geometry
  @geometry
end

#idObject

Id of the object



114
115
116
# File 'lib/geocoding.rb', line 114

def id
  @id
end

#locationObject

Location of the object



124
125
126
# File 'lib/geocoding.rb', line 124

def location
  @location
end

#propertiesObject

Properties of the object



122
123
124
# File 'lib/geocoding.rb', line 122

def properties
  @properties
end

Instance Method Details

#to_sObject



139
140
141
# File 'lib/geocoding.rb', line 139

def to_s
  self.geometry.to_s
end