Class: CloudMade::GeoResult
- Inherits:
-
Object
- Object
- CloudMade::GeoResult
- Defined in:
- lib/geocoding.rb
Instance Attribute Summary collapse
-
#bounds ⇒ Object
Bounds of result set.
-
#centroid ⇒ Object
Centroid of the object.
-
#geometry ⇒ Object
Geometry of the object.
-
#id ⇒ Object
Id of the object.
-
#location ⇒ Object
Location of the object.
-
#properties ⇒ Object
Properties of the object.
Instance Method Summary collapse
-
#initialize(data) ⇒ GeoResult
constructor
A new instance of GeoResult.
- #to_s ⇒ Object
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
#bounds ⇒ Object
Bounds of result set
120 121 122 |
# File 'lib/geocoding.rb', line 120 def bounds @bounds end |
#centroid ⇒ Object
Centroid of the object
118 119 120 |
# File 'lib/geocoding.rb', line 118 def centroid @centroid end |
#geometry ⇒ Object
Geometry of the object
116 117 118 |
# File 'lib/geocoding.rb', line 116 def geometry @geometry end |
#id ⇒ Object
Id of the object
114 115 116 |
# File 'lib/geocoding.rb', line 114 def id @id end |
#location ⇒ Object
Location of the object
124 125 126 |
# File 'lib/geocoding.rb', line 124 def location @location end |
#properties ⇒ Object
Properties of the object
122 123 124 |
# File 'lib/geocoding.rb', line 122 def properties @properties end |
Instance Method Details
#to_s ⇒ Object
139 140 141 |
# File 'lib/geocoding.rb', line 139 def to_s self.geometry.to_s end |