Class: Geocoder::Result::Here
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Here
show all
- Defined in:
- lib/geocoder/results/here.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #latitude, #longitude
Instance Method Details
#address(format = :full) ⇒ Object
A string in the given format.
9
10
11
|
# File 'lib/geocoder/results/here.rb', line 9
def address(format = :full)
address_data["label"]
end
|
#city ⇒ Object
41
42
43
|
# File 'lib/geocoder/results/here.rb', line 41
def city
address_data["city"]
end
|
#coordinates ⇒ Object
A two-element array: [lat, lon].
16
17
18
19
|
# File 'lib/geocoder/results/here.rb', line 16
def coordinates
fail unless d = @data["position"]
[d["lat"].to_f, d["lng"].to_f]
end
|
#country ⇒ Object
53
54
55
|
# File 'lib/geocoder/results/here.rb', line 53
def country
address_data["countryName"]
end
|
#country_code ⇒ Object
57
58
59
|
# File 'lib/geocoder/results/here.rb', line 57
def country_code
address_data["countryCode"]
end
|
#postal_code ⇒ Object
37
38
39
|
# File 'lib/geocoder/results/here.rb', line 37
def postal_code
address_data["postalCode"]
end
|
#province ⇒ Object
33
34
35
|
# File 'lib/geocoder/results/here.rb', line 33
def province
address_data["county"]
end
|
#province_code ⇒ Object
49
50
51
|
# File 'lib/geocoder/results/here.rb', line 49
def province_code
address_data["state"]
end
|
#route ⇒ Object
21
22
23
|
# File 'lib/geocoder/results/here.rb', line 21
def route
address_data["street"]
end
|
#state ⇒ Object
29
30
31
|
# File 'lib/geocoder/results/here.rb', line 29
def state
address_data["state"]
end
|
#state_code ⇒ Object
45
46
47
|
# File 'lib/geocoder/results/here.rb', line 45
def state_code
address_data["stateCode"]
end
|
#street_number ⇒ Object
25
26
27
|
# File 'lib/geocoder/results/here.rb', line 25
def street_number
address_data["houseNumber"]
end
|
#viewport ⇒ Object
61
62
63
64
65
66
67
68
69
|
# File 'lib/geocoder/results/here.rb', line 61
def viewport
return [] if data["resultType"] == "place"
map_view = data["mapView"]
south = map_view["south"]
west = map_view["west"]
north = map_view["north"]
east = map_view["east"]
[south, west, north, east]
end
|