Class: GeoPack
- Inherits:
-
Object
- Object
- GeoPack
- Defined in:
- lib/geo_pack.rb,
lib/geo_pack/geo_names.rb,
lib/geo_pack/rillow_helper.rb,
lib/geo_pack/urban_mapping.rb
Defined Under Namespace
Modules: RillowHelper Classes: GeoNames, UrbanMapping
Instance Method Summary collapse
- #get_location(address, options = {}) ⇒ Object
- #get_property_details(address) ⇒ Object
-
#initialize(config_file_path) ⇒ GeoPack
constructor
A new instance of GeoPack.
Constructor Details
#initialize(config_file_path) ⇒ GeoPack
Returns a new instance of GeoPack.
11 12 13 14 15 16 |
# File 'lib/geo_pack.rb', line 11 def initialize(config_file_path) config = YAML.load_file(config_file_path) @urban_mapping = UrbanMapping.new(config["urbanmapping"]["neighborhoods_apikey"], config["urbanmapping"]["secret"]) @geo_names = GeoNames.new @zillower = Zillower.new(config["zillow"]["zwsid"]) end |
Instance Method Details
#get_location(address, options = {}) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/geo_pack.rb', line 18 def get_location(address, = {}) location = {} location.merge!(get_address_city_and_state(address, )) return location if [:exclude] == :neighborhood || location.empty? location.merge!(get_neighborhood(location[:address][:geom])) location end |
#get_property_details(address) ⇒ Object
26 27 28 29 |
# File 'lib/geo_pack.rb', line 26 def get_property_details(address) geokit_result = GeoKit::Geocoders::MultiGeocoder.geocode(address) @zillower.lookup_address(:address => geokit_result.street_address, :citystatezip => "#{geokit_result.city}, #{geokit_result.state}, #{geokit_result.zip}") end |