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



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

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

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



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_typeObject



41
42
43
# File 'lib/geocoder/results/esri.rb', line 41

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

#postal_codeObject



32
33
34
# File 'lib/geocoder/results/esri.rb', line 32

def postal_code
  attributes['Postal']
end

#state_codeObject Also known as: state



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

def state_code
  attributes['Region']
end

#viewportObject



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