Class: USGeo::CoreBasedStatisticalArea
- Inherits:
-
BaseRecord
- Object
- ActiveRecord::Base
- BaseRecord
- USGeo::CoreBasedStatisticalArea
- Includes:
- Demographics
- Defined in:
- lib/us_geo/core_based_statistical_area.rb
Overview
Core based statistical area composed of one or more counties anchored by an urban center. Includes both metropolitan (population > 50,000) and micropolitan (population > 10,000 but < 50,000) areas.
Direct Known Subclasses
Constant Summary
Constants inherited from BaseRecord
BaseRecord::STATUS_IMPORTED, BaseRecord::STATUS_MANUAL, BaseRecord::STATUS_REMOVED
Class Method Summary collapse
Instance 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
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/us_geo/core_based_statistical_area.rb', line 27 def load!(uri = nil) location = data_uri(uri || "core_based_statistical_areas.csv") import! do load_data_file(location) do |row| load_record!(geoid: row["GEOID"]) do |record| record.type = (row["Population"].to_i >= 50_000 ? "MetropolitanArea" : "MicropolitanArea") record.name = row["Name"] record.csa_geoid = row["CSA"] 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"]) record.lat = row["Latitude"] record.lng = row["Longitude"] end end end end |
Instance Method Details
#metropolitan? ⇒ Boolean
48 49 50 |
# File 'lib/us_geo/core_based_statistical_area.rb', line 48 def metropolitan? raise NotImplementedError end |
#micropolitan? ⇒ Boolean
52 53 54 |
# File 'lib/us_geo/core_based_statistical_area.rb', line 52 def micropolitan? raise NotImplementedError end |