lib/earth/locality/census_division/data_miner.rb in earth-0.11.1 vs lib/earth/locality/census_division/data_miner.rb in earth-0.11.2

- old
+ new

@@ -8,13 +8,15 @@ Conversions.register :hundred_cubic_feet_per_room_night, :cubic_metres_per_room_night, 2.83168466 Conversions.register :gallons_per_room_night, :litres_per_room_night, 3.78541178 Conversions.register :thousand_btu_per_room_night, :megajoules_per_room_night, 1.05505585 end - import 'the U.S. Census Geographic Terms and Definitions', - :url => 'http://www.census.gov/popest/geographic/codes02.csv', - :skip => 9, - :select => lambda { |row| row['Division'].to_s.strip != 'X' and row['FIPS CODE STATE'].to_s.strip == 'X'} do + # http://www.census.gov/popest/geographic/codes02.csv + import('the U.S. Census Geographic Terms and Definitions', + :url => 'http://www.census.gov/popest/about/geo/state_geocodes_v2009.txt', + :skip => 6, + :headers => %w{ Region Division FIPS Name }, + :select => ::Proc.new { |row| row['Division'].to_i > 0 and row['FIPS'].to_i == 0 }) do key 'number', :field_name => 'Division' store 'name', :field_name => 'Name' store 'census_region_number', :field_name => 'Region' store 'census_region_name', :field_name => 'Region', :dictionary => { :input => 'number', :output => 'name', :url => 'http://data.brighterplanet.com/census_regions.csv' } end