Class: CloudMade::GeoResult
- Inherits:
-
Object
- Object
- CloudMade::GeoResult
- Defined in:
- lib/cloudmade/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
- #to_wkt ⇒ Object
Constructor Details
#initialize(data) ⇒ GeoResult
Returns a new instance of GeoResult.
131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/cloudmade/geocoding.rb', line 131 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
125 126 127 |
# File 'lib/cloudmade/geocoding.rb', line 125 def bounds @bounds end |
#centroid ⇒ Object
Centroid of the object
123 124 125 |
# File 'lib/cloudmade/geocoding.rb', line 123 def centroid @centroid end |
#geometry ⇒ Object
Geometry of the object
121 122 123 |
# File 'lib/cloudmade/geocoding.rb', line 121 def geometry @geometry end |
#id ⇒ Object
Id of the object
119 120 121 |
# File 'lib/cloudmade/geocoding.rb', line 119 def id @id end |
#location ⇒ Object
Location of the object
129 130 131 |
# File 'lib/cloudmade/geocoding.rb', line 129 def location @location end |
#properties ⇒ Object
Properties of the object
127 128 129 |
# File 'lib/cloudmade/geocoding.rb', line 127 def properties @properties end |
Instance Method Details
#to_s ⇒ Object
144 145 146 |
# File 'lib/cloudmade/geocoding.rb', line 144 def to_s self.geometry.to_s end |
#to_wkt ⇒ Object
148 149 150 |
# File 'lib/cloudmade/geocoding.rb', line 148 def to_wkt self.geometry.to_wkt end |