Class: Geocoder::Result::Nominatim
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Nominatim
show all
- Defined in:
- lib/geocoder/results/nominatim.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
81
82
83
84
|
# File 'lib/geocoder/results/nominatim.rb', line 81
def self.response_attributes
%w[place_id osm_type osm_id boundingbox license
polygonpoints display_name class type stadium]
end
|
Instance Method Details
#address ⇒ Object
17
18
19
|
# File 'lib/geocoder/results/nominatim.rb', line 17
def address
@data['display_name']
end
|
#city ⇒ Object
28
29
30
31
32
33
|
# File 'lib/geocoder/results/nominatim.rb', line 28
def city
%w[city town village hamlet].each do |key|
return @data['address'][key] if @data['address'].key?(key)
end
return nil
end
|
#coordinates ⇒ Object
69
70
71
|
# File 'lib/geocoder/results/nominatim.rb', line 69
def coordinates
[@data['lat'].to_f, @data['lon'].to_f]
end
|
#country ⇒ Object
57
58
59
|
# File 'lib/geocoder/results/nominatim.rb', line 57
def country
@data['address']['country']
end
|
#country_code ⇒ Object
61
62
63
|
# File 'lib/geocoder/results/nominatim.rb', line 61
def country_code
@data['address']['country_code']
end
|
#county ⇒ Object
53
54
55
|
# File 'lib/geocoder/results/nominatim.rb', line 53
def county
@data['address']['county']
end
|
#house_number ⇒ Object
13
14
15
|
# File 'lib/geocoder/results/nominatim.rb', line 13
def house_number
@data['address']['house_number']
end
|
#place_class ⇒ Object
73
74
75
|
# File 'lib/geocoder/results/nominatim.rb', line 73
def place_class
@data['class']
end
|
#place_type ⇒ Object
77
78
79
|
# File 'lib/geocoder/results/nominatim.rb', line 77
def place_type
@data['type']
end
|
#poi ⇒ Object
6
7
8
9
10
11
|
# File 'lib/geocoder/results/nominatim.rb', line 6
def poi
%w[building university school hospital mall hotel restaurant stadium bus_stop tram_stop].each do |key|
return @data['address'][key] if @data['address'].key?(key)
end
return nil
end
|
#postal_code ⇒ Object
49
50
51
|
# File 'lib/geocoder/results/nominatim.rb', line 49
def postal_code
@data['address']['postcode']
end
|
#state ⇒ Object
Also known as:
state_code
43
44
45
|
# File 'lib/geocoder/results/nominatim.rb', line 43
def state
@data['address']['state']
end
|
#street ⇒ Object
21
22
23
24
25
26
|
# File 'lib/geocoder/results/nominatim.rb', line 21
def street
%w[road pedestrian highway].each do |key|
return @data['address'][key] if @data['address'].key?(key)
end
return nil
end
|
#suburb ⇒ Object
65
66
67
|
# File 'lib/geocoder/results/nominatim.rb', line 65
def suburb
@data['address']['suburb']
end
|
#town ⇒ Object
39
40
41
|
# File 'lib/geocoder/results/nominatim.rb', line 39
def town
@data['address']['town']
end
|
#village ⇒ Object
35
36
37
|
# File 'lib/geocoder/results/nominatim.rb', line 35
def village
@data['address']['village']
end
|