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
45
46
47
|
# File 'lib/geocoder/results/esri.rb', line 45
def coordinates
[geometry["y"], geometry["x"]]
end
|
#country ⇒ Object
Also known as:
country_code
25
26
27
28
|
# File 'lib/geocoder/results/esri.rb', line 25
def country
country_key = reverse_geocode? ? "CountryCode" : "Country"
attributes[country_key]
end
|
#place_name ⇒ Object
36
37
38
39
|
# File 'lib/geocoder/results/esri.rb', line 36
def place_name
place_name_key = reverse_geocode? ? "Address" : "PlaceName"
attributes[place_name_key]
end
|
#place_type ⇒ Object
41
42
43
|
# File 'lib/geocoder/results/esri.rb', line 41
def place_type
reverse_geocode? ? "Address" : attributes['Type']
end
|
#postal_code ⇒ Object
32
33
34
|
# File 'lib/geocoder/results/esri.rb', line 32
def postal_code
attributes['Postal']
end
|
#state_code ⇒ Object
Also known as:
state
19
20
21
|
# File 'lib/geocoder/results/esri.rb', line 19
def state_code
attributes['Region']
end
|
#viewport ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/geocoder/results/esri.rb', line 49
def viewport
north = attributes['Ymax']
south = attributes['Ymin']
east = attributes['Xmax']
west = attributes['Xmin']
[south, west, north, east]
end
|