Class: USGeo::UrbanArea
- Inherits:
-
BaseRecord
- Object
- ActiveRecord::Base
- BaseRecord
- USGeo::UrbanArea
- Includes:
- Demographics
- Defined in:
- lib/us_geo/urban_area.rb
Overview
Urban areas are split into either urbanized areas (population > 50,000) or urban cluster (population < 50,000).
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
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/us_geo/urban_area.rb', line 36 def load!(uri = nil) location = data_uri(uri || "urban_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 ? "UrbanizedArea" : "UrbanCluster") record.name = row["Name"] record.primary_county_geoid = row["Primary County"] 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
#cluster? ⇒ Boolean
61 62 63 |
# File 'lib/us_geo/urban_area.rb', line 61 def cluster? raise NotImplementedError end |
#urbanized? ⇒ Boolean
57 58 59 |
# File 'lib/us_geo/urban_area.rb', line 57 def urbanized? raise NotImplementedError end |