Class: USGeo::MetropolitanDivision

Inherits:
BaseRecord
  • Object
show all
Includes:
Demographics
Defined in:
lib/us_geo/metropolitan_division.rb

Overview

Division of very large metropolitian areas into groups of approximately 2.5 million people.

Constant Summary

Constants inherited from BaseRecord

BaseRecord::STATUS_IMPORTED, BaseRecord::STATUS_MANUAL, BaseRecord::STATUS_REMOVED

Class Method Summary collapse

Methods included from Demographics

#percent_land, #population_density, #total_area

Methods inherited from BaseRecord

#imported?, #manual?, #removed?

Class Method Details

.load!(uri = nil) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/us_geo/metropolitan_division.rb', line 23

def load!(uri = nil)
  location = data_uri(uri || "metropolitan_divisions.csv")

  import! do
    load_data_file(location) do |row|
      load_record!(geoid: row["GEOID"]) do |record|
        record.name = row["Name"]
        record.cbsa_geoid = row["CBSA"]
        record.population = row["Population"]
        record.housing_units = row["Housing Units"]
        record.land_area = area_meters_to_miles(row["Land Area"])
        record.water_area = area_meters_to_miles(row["Water Area"])
      end
    end
  end
end