Class: Geocoder::Result::Osmnames
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Osmnames
show all
- Defined in:
- lib/geocoder/results/osmnames.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #latitude, #longitude, #province, #province_code
Class Method Details
.response_attributes ⇒ Object
43
44
45
46
|
# File 'lib/geocoder/results/osmnames.rb', line 43
def self.response_attributes
%w[house_number street city name osm_id osm_type boundingbox place_rank
importance county rank name_suffix]
end
|
Instance Method Details
#address ⇒ Object
5
6
7
|
# File 'lib/geocoder/results/osmnames.rb', line 5
def address
@data['display_name']
end
|
#coordinates ⇒ Object
9
10
11
|
# File 'lib/geocoder/results/osmnames.rb', line 9
def coordinates
[@data['lat'].to_f, @data['lon'].to_f]
end
|
#country ⇒ Object
39
40
41
|
# File 'lib/geocoder/results/osmnames.rb', line 39
def country
@data['country']
end
|
#country_code ⇒ Object
35
36
37
|
# File 'lib/geocoder/results/osmnames.rb', line 35
def country_code
@data['country_code']
end
|
#place_class ⇒ Object
23
24
25
|
# File 'lib/geocoder/results/osmnames.rb', line 23
def place_class
@data['class']
end
|
#place_type ⇒ Object
27
28
29
|
# File 'lib/geocoder/results/osmnames.rb', line 27
def place_type
@data['type']
end
|
#postal_code ⇒ Object
31
32
33
|
# File 'lib/geocoder/results/osmnames.rb', line 31
def postal_code
''
end
|
#state ⇒ Object
Also known as:
state_code
18
19
20
|
# File 'lib/geocoder/results/osmnames.rb', line 18
def state
@data['state']
end
|
#viewport ⇒ Object
13
14
15
16
|
# File 'lib/geocoder/results/osmnames.rb', line 13
def viewport
west, south, east, north = @data['boundingbox'].map(&:to_f)
[south, west, north, east]
end
|