Sha256: e3023a0a5c4c17de3c9a6ae2239759bb2802377c0527fdc4fdcce2a6aa78e5c8

Contents?: true

Size: 1.61 KB

Versions: 10

Compression:

Stored size: 1.61 KB

Contents

ZipCode.class_eval do
  # sabshere 9/20/10 this isn't called anywhere
  # def set_latitude_and_longitude
  #   return if latitude.present? and longitude.present?
  #   a = Geokit::Geocoders::YahooGeocoder.geocode name
  #   update_attributes! :latitude => a.lat, :longitude => a.lng
  # end
  
  data_miner do
    schema Earth.database_options do
      string   'name'
      string   'state_postal_abbreviation'
      string   'description'
      string   'latitude'
      string   'longitude'
      string   'egrid_subregion_abbreviation'
      string   'climate_division_name'
    end
    
    import 'the Mapping Hacks zipcode database',
           :url => 'http://mappinghacks.com/data/zipcode.zip',
           :filename => 'zipcode.csv' do
      key   'name', :field_name => 'zip', :sprintf => '%05d'
      store 'state_postal_abbreviation', :field_name => 'state'
      store 'description', :field_name => 'city'
      store 'latitude'
      store 'longitude'
    end
    
    import 'a Brighter Planet-created list of zipcode eGRID Subregions',
           :url => 'http://static.brighterplanet.com/science/data/electricity/egrid/models_export/zip_subregions.csv' do
      key   'name', :field_name => 'zip', :sprintf => '%05d'
      store 'egrid_subregion_abbreviation', :field_name => 'primary_subregion'
    end
    
    import 'a Brighter Planet-created list of zipcode Climate Divisions',
           :url => 'http://static.brighterplanet.com/science/data/geography/zip_code_name-climate_division_name.csv' do
      key   'name', :field_name => 'zip_code_name', :sprintf => '%05d'
      store 'climate_division_name'
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
earth-0.4.6 lib/earth/locality/zip_code/data_miner.rb
earth-0.4.5 lib/earth/locality/zip_code/data_miner.rb
earth-0.4.4 lib/earth/locality/zip_code/data_miner.rb
earth-0.4.3 lib/earth/locality/zip_code/data_miner.rb
earth-0.4.2 lib/earth/locality/zip_code/data_miner.rb
earth-0.4.1 lib/earth/locality/zip_code/data_miner.rb
earth-0.4.0 lib/earth/locality/zip_code/data_miner.rb
earth-0.3.15 lib/earth/locality/zip_code/data_miner.rb
earth-0.3.14 lib/earth/locality/zip_code/data_miner.rb
earth-0.3.13 lib/earth/locality/zip_code/data_miner.rb