Class: USGeo::Place
- Inherits:
-
BaseRecord
- Object
- ActiveRecord::Base
- BaseRecord
- USGeo::Place
- Includes:
- Area, Population
- 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
Instance Attribute Summary collapse
-
#fips_class_code ⇒ String
2-character FIPS class code.
-
#geoid ⇒ String
7-digit code for the place.
-
#name ⇒ String
Name of the place.
-
#short_name ⇒ String
Short name of the place.
-
#state_code ⇒ String
2-letter code for the state.
Attributes included from Area
Attributes included from Population
Attributes inherited from BaseRecord
Class Method Summary collapse
Instance Method Summary collapse
-
#combined_statistical_area ⇒ CombinedStatisticalArea?
Combined statistical area that the place is a part of.
-
#core_based_statistical_area ⇒ CoreBasedStatisticalArea?
Core-based statistical area that the place is a part of.
-
#full_name ⇒ String
Full name of the place as short name plus the state.
-
#metropolitan_division ⇒ MetropolitanDivision?
Metropolitan division that the place is a part of.
Methods included from Area
#land_area_km, #percent_land, #total_area, #water_area_km
Methods included from Population
#housing_density, #housing_density_km, #population_density, #population_density_km
Methods inherited from BaseRecord
#imported?, #manual?, #removed?
Instance Attribute Details
#fips_class_code ⇒ String
Returns 2-character FIPS class code.
|
|
# File 'lib/us_geo/place.rb', line 63
|
#geoid ⇒ String
Returns 7-digit code for the place.
|
|
# File 'lib/us_geo/place.rb', line 51
|
#name ⇒ String
Returns Name of the place.
|
|
# File 'lib/us_geo/place.rb', line 54
|
#short_name ⇒ String
Returns Short name of the place.
|
|
# File 'lib/us_geo/place.rb', line 57
|
#state_code ⇒ String
Returns 2-letter code for the state.
|
|
# File 'lib/us_geo/place.rb', line 60
|
Class Method Details
.load!(uri = nil) ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/us_geo/place.rb', line 86 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 = row["Land Area"] record.water_area = row["Water Area"] record.lat = row["Latitude"] record.lng = row["Longitude"] end end end end |
Instance Method Details
#combined_statistical_area ⇒ CombinedStatisticalArea?
Returns Combined statistical area that the place is a part of.
68 |
# File 'lib/us_geo/place.rb', line 68 delegate :combined_statistical_area, to: :primary_county, allow_nil: true |
#core_based_statistical_area ⇒ CoreBasedStatisticalArea?
Returns Core-based statistical area that the place is a part of.
72 |
# File 'lib/us_geo/place.rb', line 72 delegate :core_based_statistical_area, to: :primary_county, allow_nil: true |
#full_name ⇒ String
Full name of the place as short name plus the state.
81 82 83 |
# File 'lib/us_geo/place.rb', line 81 def full_name "#{short_name}, #{state_code}" end |
#metropolitan_division ⇒ MetropolitanDivision?
Returns Metropolitan division that the place is a part of.
76 |
# File 'lib/us_geo/place.rb', line 76 delegate :metropolitan_division, to: :primary_county, allow_nil: true |