Class: Geocoder::Result::Esri
- Inherits:
-
Base
- Object
- Base
- Geocoder::Result::Esri
show all
- Defined in:
- lib/geocoder/results/esri.rb
Instance Attribute Summary
Attributes inherited from Base
#cache_hit, #data
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #latitude, #longitude, #province, #province_code
Instance Method Details
#address ⇒ Object
6
7
8
9
|
# File 'lib/geocoder/results/esri.rb', line 6
def address
address_key = reverse_geocode? ? 'Address' : 'Match_addr'
attributes[address_key]
end
|
#city ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/geocoder/results/esri.rb', line 11
def city
if !reverse_geocode? && is_city?
place_name
else
attributes['City']
end
end
|
#coordinates ⇒ Object
48
49
50
|
# File 'lib/geocoder/results/esri.rb', line 48
def coordinates
[geometry["y"], geometry["x"]]
end
|
#country ⇒ Object
Also known as:
country_code
28
29
30
31
|
# File 'lib/geocoder/results/esri.rb', line 28
def country
country_key = reverse_geocode? ? "CountryCode" : "Country"
attributes[country_key]
end
|
#place_name ⇒ Object
39
40
41
42
|
# File 'lib/geocoder/results/esri.rb', line 39
def place_name
place_name_key = reverse_geocode? ? "Address" : "PlaceName"
attributes[place_name_key]
end
|
#place_type ⇒ Object
44
45
46
|
# File 'lib/geocoder/results/esri.rb', line 44
def place_type
reverse_geocode? ? "Address" : attributes['Type']
end
|
#postal_code ⇒ Object
35
36
37
|
# File 'lib/geocoder/results/esri.rb', line 35
def postal_code
attributes['Postal']
end
|
#state ⇒ Object
19
20
21
|
# File 'lib/geocoder/results/esri.rb', line 19
def state
attributes['Region']
end
|
#state_code ⇒ Object
23
24
25
26
|
# File 'lib/geocoder/results/esri.rb', line 23
def state_code
abbr = attributes['RegionAbbr']
abbr.to_s == "" ? state : abbr
end
|
#viewport ⇒ Object
52
53
54
55
56
57
58
|
# File 'lib/geocoder/results/esri.rb', line 52
def viewport
north = attributes['Ymax']
south = attributes['Ymin']
east = attributes['Xmax']
west = attributes['Xmin']
[south, west, north, east]
end
|