Class: CloudMade::GeoResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#boundsObject

Bounds of result set



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

def bounds
  @bounds
end

#centroidObject

Centroid of the object



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

def centroid
  @centroid
end

#geometryObject

Geometry of the object



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

def geometry
  @geometry
end

#idObject

Id of the object



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

def id
  @id
end

#locationObject

Location of the object



129
130
131
# File 'lib/cloudmade/geocoding.rb', line 129

def location
  @location
end

#propertiesObject

Properties of the object



127
128
129
# File 'lib/cloudmade/geocoding.rb', line 127

def properties
  @properties
end

Instance Method Details

#to_sObject



144
145
146
# File 'lib/cloudmade/geocoding.rb', line 144

def to_s
  self.geometry.to_s
end

#to_wktObject



148
149
150
# File 'lib/cloudmade/geocoding.rb', line 148

def to_wkt
  self.geometry.to_wkt
end