Class: USGeo::Place
- Inherits:
-
BaseRecord
- Object
- ActiveRecord::Base
- BaseRecord
- USGeo::Place
- Includes:
- Demographics
- Defined in:
- lib/us_geo/place.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
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/us_geo/place.rb', line 35 def load!(uri = nil) location = data_uri(uri || "places.csv") import! do load_data_file(location) do |row| load_record!(geoid: row["GEOID"]) do |record| record.gnis_id = row["GNIS ID"] record.name = row["Name"] record.short_name = row["Short Name"] record.state_code = row["State"] record.primary_county_geoid = row["County GEOID"] record.urban_area_geoid = row["Urban Area GEOID"] record.fips_class_code = row["FIPS Class"] 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 |