Class: Concensus::Zipcode

Inherits:
Resource show all
Defined in:
lib/concensus/zipcode.rb

Instance Attribute Summary

Attributes inherited from Resource

#geometry, #name, #state, #year

Class Method Summary collapse

Methods inherited from Resource

already_unzipped?, file_extension, filename_without_extension, get_and_unzip, #initialize, process_find, state_code_to_id

Constructor Details

This class inherits a constructor from Concensus::Resource

Class Method Details

.find(state, name = nil) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/concensus/zipcode.rb', line 4

def self.find(state, name = nil)
  
  if Concensus::configuration.year == 2010
    attribute_key = "ZCTA5CE10"
    shp_file_path = get_and_unzip("ZCTA5/2010/tl_2010_#{state_code_to_id(state)}_zcta510.zip")
  else
    raise NoResourceForYear
  end

  return process_find("Zipcode", shp_file_path, attribute_key, state, name)      
  
end

.find_all(state) ⇒ Object


17
18
19
# File 'lib/concensus/zipcode.rb', line 17

def self.find_all(state)
  find(state)       
end