Class: Geocoder::Result::Esri

Inherits:
Base
  • Object
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

Constructor Details

This class inherits a constructor from Geocoder::Result::Base

Instance Method Details

#addressObject



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

#cityObject



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

#coordinatesObject



48
49
50
# File 'lib/geocoder/results/esri.rb', line 48

def coordinates
  [geometry["y"], geometry["x"]]
end

#countryObject 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_nameObject



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_typeObject



44
45
46
# File 'lib/geocoder/results/esri.rb', line 44

def place_type
  reverse_geocode? ? "Address" : attributes['Type']
end

#postal_codeObject



35
36
37
# File 'lib/geocoder/results/esri.rb', line 35

def postal_code
  attributes['Postal']
end

#stateObject



19
20
21
# File 'lib/geocoder/results/esri.rb', line 19

def state
  attributes['Region']
end

#state_codeObject



23
24
25
26
# File 'lib/geocoder/results/esri.rb', line 23

def state_code
  abbr = attributes['RegionAbbr']
  abbr.to_s == "" ? state : abbr
end

#viewportObject



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