us_geo 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +82 -0
- data/MIT_LICENSE.txt +21 -0
- data/README.md +77 -60
- data/UPDATING_TO_VERSION_2.md +172 -0
- data/VERSION +1 -0
- data/db/migrate/20190221054200_create_regions.rb +4 -2
- data/db/migrate/20190221054300_create_divisions.rb +4 -2
- data/db/migrate/20190221054400_create_states.rb +4 -2
- data/db/migrate/20190221054500_create_combined_statistical_areas.rb +4 -2
- data/db/migrate/20190221054600_create_core_based_statistical_areas.rb +4 -2
- data/db/migrate/20190221054650_create_metropolitan_divisions.rb +4 -2
- data/db/migrate/20190221054700_create_counties.rb +4 -3
- data/db/migrate/20190221054800_create_zctas.rb +4 -2
- data/db/migrate/20190221054900_create_zcta_counties.rb +4 -2
- data/db/migrate/20190221055000_create_urban_areas.rb +4 -2
- data/db/migrate/20190221055100_create_urban_area_counties.rb +4 -4
- data/db/migrate/20190221055200_create_zcta_urban_areas.rb +4 -4
- data/db/migrate/20190221060000_create_places.rb +4 -2
- data/db/migrate/20190221061000_create_place_counties.rb +4 -2
- data/db/migrate/20190221062000_create_zcta_places.rb +4 -4
- data/db/migrate/20190221063000_create_county_subdivisions.rb +4 -2
- data/db/migrate/20220722000000_allow_null_zcta_counties_demographics.rb +23 -0
- data/db/migrate/20220722000200_allow_null_zcta_places_demographics.rb +23 -0
- data/db/migrate/20230414000000_add_zcta_primary_place.rb +13 -0
- data/db/migrate/20230414000200_add_demographics_to_regions.rb +28 -0
- data/db/migrate/20230414000300_add_demographics_to_divisions.rb +28 -0
- data/db/migrate/20230414000400_add_demographics_to_states.rb +28 -0
- data/db/migrate/20230414000700_add_short_name_to_core_based_statistical_areas.rb +22 -0
- data/db/migrate/20230414000750_add_short_name_to_combined_statistical_areas.rb +22 -0
- data/db/migrate/20230414000800_create_zcta_mappings.rb +18 -0
- data/db/migrate/20230417000100_create_zcta_county_subdivisions.rb +22 -0
- data/db/migrate/20230417000200_add_unique_name_index_to_county_subdivisions.rb +26 -0
- data/db/migrate/20230417000250_add_zcta_primary_county_subdivision.rb +13 -0
- data/db/migrate/20230417000300_create_urban_area_county_subdivisions.rb +23 -0
- data/db/migrate/20230417000400_allow_null_urban_area_counties_demographics.rb +23 -0
- data/db/migrate/20230417000500_allow_null_zcta_urban_areas_demographics.rb +23 -0
- data/db/migrate/20230417000600_add_additional_time_zone_name_to_counties.rb +13 -0
- data/db/schema.rb +303 -0
- data/explorer_app/.gitattributes +7 -0
- data/explorer_app/.gitignore +34 -0
- data/explorer_app/Gemfile +38 -0
- data/explorer_app/Rakefile +6 -0
- data/explorer_app/app/assets/images/.keep +0 -0
- data/explorer_app/app/assets/stylesheets/application.css +1 -0
- data/explorer_app/app/controllers/application_controller.rb +64 -0
- data/explorer_app/app/controllers/combined_statistical_areas_controller.rb +12 -0
- data/explorer_app/app/controllers/concerns/.keep +0 -0
- data/explorer_app/app/controllers/core_based_statistical_areas_controller.rb +36 -0
- data/explorer_app/app/controllers/counties_controller.rb +22 -0
- data/explorer_app/app/controllers/county_subdivisions_controller.rb +23 -0
- data/explorer_app/app/controllers/divisions_controller.rb +27 -0
- data/explorer_app/app/controllers/home_controller.rb +6 -0
- data/explorer_app/app/controllers/metropolitan_divisions_controller.rb +27 -0
- data/explorer_app/app/controllers/places_controller.rb +23 -0
- data/explorer_app/app/controllers/regions_controller.rb +13 -0
- data/explorer_app/app/controllers/states_controller.rb +25 -0
- data/explorer_app/app/controllers/urban_areas_controller.rb +24 -0
- data/explorer_app/app/controllers/zctas_controller.rb +23 -0
- data/explorer_app/app/helpers/application_helper.rb +137 -0
- data/explorer_app/app/models/application_record.rb +3 -0
- data/explorer_app/app/models/concerns/.keep +0 -0
- data/explorer_app/app/views/combined_statistical_areas/_table.html.erb +18 -0
- data/explorer_app/app/views/combined_statistical_areas/index.html.erb +7 -0
- data/explorer_app/app/views/combined_statistical_areas/show.html.erb +52 -0
- data/explorer_app/app/views/core_based_statistical_areas/_table.html.erb +32 -0
- data/explorer_app/app/views/core_based_statistical_areas/index.html.erb +19 -0
- data/explorer_app/app/views/core_based_statistical_areas/show.html.erb +60 -0
- data/explorer_app/app/views/counties/_table.html.erb +64 -0
- data/explorer_app/app/views/counties/show.html.erb +96 -0
- data/explorer_app/app/views/county_subdivisions/_table.html.erb +48 -0
- data/explorer_app/app/views/county_subdivisions/show.html.erb +84 -0
- data/explorer_app/app/views/divisions/_table.html.erb +24 -0
- data/explorer_app/app/views/divisions/index.html.erb +3 -0
- data/explorer_app/app/views/divisions/show.html.erb +3 -0
- data/explorer_app/app/views/home/index.html.erb +23 -0
- data/explorer_app/app/views/layouts/application.html.erb +34 -0
- data/explorer_app/app/views/metropolitan_divisions/_table.html.erb +42 -0
- data/explorer_app/app/views/metropolitan_divisions/index.html.erb +8 -0
- data/explorer_app/app/views/metropolitan_divisions/show.html.erb +46 -0
- data/explorer_app/app/views/places/_table.html.erb +47 -0
- data/explorer_app/app/views/places/show.html.erb +92 -0
- data/explorer_app/app/views/regions/_table.html.erb +18 -0
- data/explorer_app/app/views/regions/index.html.erb +7 -0
- data/explorer_app/app/views/regions/show.html.erb +3 -0
- data/explorer_app/app/views/shared/_breadcrumbs.html.erb +13 -0
- data/explorer_app/app/views/shared/_demographics_cells.html.erb +5 -0
- data/explorer_app/app/views/shared/_demographics_headers.html.erb +5 -0
- data/explorer_app/app/views/states/_table.html.erb +31 -0
- data/explorer_app/app/views/states/index.html.erb +7 -0
- data/explorer_app/app/views/states/show.html.erb +54 -0
- data/explorer_app/app/views/urban_areas/_table.html.erb +45 -0
- data/explorer_app/app/views/urban_areas/index.html.erb +19 -0
- data/explorer_app/app/views/urban_areas/show.html.erb +68 -0
- data/explorer_app/app/views/zctas/_table.html.erb +60 -0
- data/explorer_app/app/views/zctas/show.html.erb +104 -0
- data/explorer_app/bin/bundle +109 -0
- data/explorer_app/bin/rails +4 -0
- data/explorer_app/bin/rake +4 -0
- data/explorer_app/bin/setup +33 -0
- data/explorer_app/config/application.rb +37 -0
- data/explorer_app/config/boot.rb +3 -0
- data/explorer_app/config/database.yml +13 -0
- data/explorer_app/config/environment.rb +5 -0
- data/explorer_app/config/environments/development.rb +59 -0
- data/explorer_app/config/initializers/filter_parameter_logging.rb +8 -0
- data/explorer_app/config/locales/en.yml +2 -0
- data/explorer_app/config/puma.rb +43 -0
- data/explorer_app/config/routes.rb +56 -0
- data/explorer_app/config.ru +6 -0
- data/explorer_app/db/seeds.rb +7 -0
- data/explorer_app/lib/assets/.keep +0 -0
- data/explorer_app/lib/tasks/.keep +0 -0
- data/explorer_app/log/.keep +0 -0
- data/explorer_app/public/404.html +67 -0
- data/explorer_app/public/422.html +67 -0
- data/explorer_app/public/500.html +66 -0
- data/explorer_app/public/apple-touch-icon-precomposed.png +0 -0
- data/explorer_app/public/apple-touch-icon.png +0 -0
- data/explorer_app/public/favicon.ico +0 -0
- data/explorer_app/public/robots.txt +1 -0
- data/explorer_app/tmp/.keep +0 -0
- data/explorer_app/tmp/pids/.keep +0 -0
- data/lib/tasks/us_geo/us_geo.rake +44 -3
- data/lib/us_geo/area.rb +44 -0
- data/lib/us_geo/base_record.rb +22 -16
- data/lib/us_geo/combined_statistical_area.rb +18 -8
- data/lib/us_geo/core_based_statistical_area.rb +24 -12
- data/lib/us_geo/county.rb +67 -16
- data/lib/us_geo/county_subdivision.rb +43 -7
- data/lib/us_geo/division.rb +17 -7
- data/lib/us_geo/metropolitan_area.rb +1 -5
- data/lib/us_geo/metropolitan_division.rb +17 -9
- data/lib/us_geo/micropolitan_area.rb +1 -5
- data/lib/us_geo/place.rb +61 -11
- data/lib/us_geo/place_county.rb +1 -4
- data/lib/us_geo/population.rb +26 -0
- data/lib/us_geo/region.rb +18 -8
- data/lib/us_geo/state.rb +32 -11
- data/lib/us_geo/urban_area.rb +46 -16
- data/lib/us_geo/urban_area_county.rb +4 -21
- data/lib/us_geo/urban_area_county_subdivision.rb +51 -0
- data/lib/us_geo/urban_cluster.rb +1 -5
- data/lib/us_geo/urbanized_area.rb +1 -5
- data/lib/us_geo/version.rb +1 -1
- data/lib/us_geo/zcta.rb +90 -13
- data/lib/us_geo/zcta_county.rb +5 -22
- data/lib/us_geo/zcta_county_subdivision.rb +51 -0
- data/lib/us_geo/zcta_mapping.rb +35 -0
- data/lib/us_geo/zcta_place.rb +5 -12
- data/lib/us_geo/zcta_urban_area.rb +3 -20
- data/lib/us_geo.rb +34 -31
- data/us_geo.gemspec +36 -0
- metadata +127 -132
- data/Gemfile +0 -5
- data/Gemfile.lock +0 -75
- data/Rakefile +0 -18
- data/db/migrate/20190221054490_create_designated_market_areas.rb +0 -16
- data/lib/us_geo/demographics.rb +0 -25
- data/lib/us_geo/designated_market_area.rb +0 -30
- data/spec/spec_helper.rb +0 -22
- data/spec/us_geo/base_record_spec.rb +0 -67
- data/spec/us_geo/combined_statistical_area_spec.rb +0 -33
- data/spec/us_geo/core_based_statistical_area_spec.rb +0 -56
- data/spec/us_geo/county_spec.rb +0 -131
- data/spec/us_geo/county_subdivision_spec.rb +0 -37
- data/spec/us_geo/demographics_spec.rb +0 -19
- data/spec/us_geo/designated_market_area_spec.rb +0 -29
- data/spec/us_geo/division_spec.rb +0 -37
- data/spec/us_geo/metropolitan_division_spec.rb +0 -41
- data/spec/us_geo/place_county_spec.rb +0 -39
- data/spec/us_geo/place_spec.rb +0 -71
- data/spec/us_geo/region_spec.rb +0 -36
- data/spec/us_geo/state_spec.rb +0 -70
- data/spec/us_geo/urban_area_county_spec.rb +0 -82
- data/spec/us_geo/urban_area_spec.rb +0 -98
- data/spec/us_geo/zcta_county_spec.rb +0 -82
- data/spec/us_geo/zcta_place_spec.rb +0 -82
- data/spec/us_geo/zcta_spec.rb +0 -99
- data/spec/us_geo/zcta_urban_area_spec.rb +0 -82
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class StatesController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def index
|
7
|
+
@states = if @division
|
8
|
+
@division.states.order(:name)
|
9
|
+
else
|
10
|
+
USGeo::State.not_removed.order(:name)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def show
|
15
|
+
@state = USGeo::State.find(params[:id])
|
16
|
+
add_breadcrumb(state_id: @state)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def set_breadcrumbs
|
22
|
+
add_region_breadcrumb
|
23
|
+
add_division_breadcrumb
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class UrbanAreasController < ApplicationController
|
4
|
+
def index
|
5
|
+
urban_areas = USGeo::UrbanArea.not_removed
|
6
|
+
|
7
|
+
@tab = params[:tab]
|
8
|
+
if @tab.present?
|
9
|
+
type = if @tab == "urbanized"
|
10
|
+
"UrbanizedArea"
|
11
|
+
elsif @tab == "cluster"
|
12
|
+
"UrbanCluster"
|
13
|
+
end
|
14
|
+
urban_areas = urban_areas.where(type: type)
|
15
|
+
end
|
16
|
+
|
17
|
+
@urban_areas = urban_areas.order(:name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def show
|
21
|
+
@urban_area = USGeo::UrbanArea.find(params[:id])
|
22
|
+
add_breadcrumb(urban_area_id: @urban_area)
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ZctasController < ApplicationController
|
4
|
+
before_action :set_breadcrumbs
|
5
|
+
|
6
|
+
def show
|
7
|
+
@zcta = USGeo::Zcta.find(params[:id])
|
8
|
+
add_breadcrumb(zcta_id: @zcta)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def set_breadcrumbs
|
14
|
+
add_region_breadcrumb
|
15
|
+
add_division_breadcrumb
|
16
|
+
add_state_breadcrumb
|
17
|
+
add_county_breadcrumb
|
18
|
+
add_combined_statistical_area_breadcrumb
|
19
|
+
add_core_based_statistical_area_breadcrumb
|
20
|
+
add_metropolitan_division_breadcrumb
|
21
|
+
add_urban_area_breadcrumb
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,137 @@
|
|
1
|
+
module ApplicationHelper
|
2
|
+
def formatted_number(number, round: nil)
|
3
|
+
if number
|
4
|
+
number = (round ? number.round(round) : auto_round(number))
|
5
|
+
number_with_delimiter(number)
|
6
|
+
else
|
7
|
+
"-"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def google_maps_link(location)
|
12
|
+
if location.lat && location.lng
|
13
|
+
url = "https://www.google.com/maps/place/#{location.lat},#{location.lng}"
|
14
|
+
link_to("#{location.lat}, #{location.lng}", url, target: "_blank")
|
15
|
+
else
|
16
|
+
"n/a"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def demographics_headers
|
21
|
+
render "shared/demographics_headers"
|
22
|
+
end
|
23
|
+
|
24
|
+
def demographics_cells(entity, round_area: nil)
|
25
|
+
render "shared/demographics_cells", entity: entity, round_area: round_area
|
26
|
+
end
|
27
|
+
|
28
|
+
def population_density(entity)
|
29
|
+
density = entity.population_density
|
30
|
+
return nil unless density
|
31
|
+
|
32
|
+
round = if density < 1
|
33
|
+
3
|
34
|
+
elsif density < 10
|
35
|
+
2
|
36
|
+
elsif density < 100
|
37
|
+
1
|
38
|
+
else
|
39
|
+
0
|
40
|
+
end
|
41
|
+
|
42
|
+
"#{formatted_number(density, round: round)} / mi²"
|
43
|
+
end
|
44
|
+
|
45
|
+
def overlap_percentage(entity, other_entity, association)
|
46
|
+
return nil unless entity && other_entity && entity.total_area > 0
|
47
|
+
|
48
|
+
belongs_to = other_entity.class.base_class.to_s.demodulize.underscore
|
49
|
+
overlap = entity.send(association).detect { |r| r.send(belongs_to) == other_entity }
|
50
|
+
return nil unless overlap
|
51
|
+
|
52
|
+
percent = overlap.total_area / entity.total_area
|
53
|
+
number_to_percentage(percent * 100, precision: 1)
|
54
|
+
end
|
55
|
+
|
56
|
+
def auto_round(number)
|
57
|
+
return number unless number.is_a?(Float)
|
58
|
+
|
59
|
+
decimals = if number < 1
|
60
|
+
3
|
61
|
+
elsif number < 10
|
62
|
+
2
|
63
|
+
elsif number < 100
|
64
|
+
1
|
65
|
+
else
|
66
|
+
0
|
67
|
+
end
|
68
|
+
|
69
|
+
number.round(decimals)
|
70
|
+
end
|
71
|
+
|
72
|
+
def breadcrumb_params(additional_params = {})
|
73
|
+
if @breadcrumbs
|
74
|
+
@breadcrumbs.merge(additional_params)
|
75
|
+
else
|
76
|
+
additional_params
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def breadcrumbs(active_label, active: nil)
|
81
|
+
render "shared/breadcrumbs", links: breadcrumb_links(active), active_label: active_label
|
82
|
+
end
|
83
|
+
|
84
|
+
def breadcrumb_links(active = nil)
|
85
|
+
return {} if @breadcrumbs.blank?
|
86
|
+
|
87
|
+
objects = @breadcrumbs.values
|
88
|
+
region = objects.detect { |b| b.is_a?(USGeo::Region) }
|
89
|
+
division = objects.detect { |b| b.is_a?(USGeo::Division) }
|
90
|
+
state = objects.detect { |b| b.is_a?(USGeo::State) }
|
91
|
+
combined_statistical_area = objects.detect { |b| b.is_a?(USGeo::CombinedStatisticalArea) }
|
92
|
+
core_based_statistical_area = objects.detect { |b| b.is_a?(USGeo::CoreBasedStatisticalArea) }
|
93
|
+
urban_area = objects.detect { |b| b.is_a?(USGeo::UrbanArea) }
|
94
|
+
metropolitan_division = objects.detect { |b| b.is_a?(USGeo::MetropolitanDivision) }
|
95
|
+
county = objects.detect { |b| b.is_a?(USGeo::County) }
|
96
|
+
county_subdivision = objects.detect { |b| b.is_a?(USGeo::CountySubdivision) }
|
97
|
+
place = objects.detect { |b| b.is_a?(USGeo::Place) }
|
98
|
+
zcta = objects.detect { |b| b.is_a?(USGeo::Zcta) }
|
99
|
+
|
100
|
+
links = {}
|
101
|
+
|
102
|
+
if region
|
103
|
+
links["Regions"] = regions_path
|
104
|
+
elsif division&.persisted?
|
105
|
+
links["Divisions"] = divisions_path
|
106
|
+
elsif state
|
107
|
+
links["States"] = states_path
|
108
|
+
elsif combined_statistical_area
|
109
|
+
links["Combined Statistical Areas"] = combined_statistical_areas_path
|
110
|
+
elsif core_based_statistical_area
|
111
|
+
links["Core Based Statistical Areas"] = core_based_statistical_areas_path
|
112
|
+
elsif urban_area
|
113
|
+
links["Urban Areas"] = urban_areas_path
|
114
|
+
end
|
115
|
+
|
116
|
+
links[region.name] = region_path(region) if breadcrumb_link?(region, active)
|
117
|
+
links[division.name] = division_path(division) if breadcrumb_link?(division, active)
|
118
|
+
links[state.name] = state_path(state) if breadcrumb_link?(state, active)
|
119
|
+
links[combined_statistical_area.name] = combined_statistical_area_path(combined_statistical_area) if breadcrumb_link?(combined_statistical_area, active)
|
120
|
+
links[core_based_statistical_area.name] = core_based_statistical_area_path(core_based_statistical_area) if breadcrumb_link?(core_based_statistical_area, active)
|
121
|
+
links[metropolitan_division.name] = metropolitan_division_path(metropolitan_division) if breadcrumb_link?(metropolitan_division, active)
|
122
|
+
links[urban_area.name] = urban_area_path(urban_area) if breadcrumb_link?(urban_area, active)
|
123
|
+
|
124
|
+
links[county.name] = county_path(county) if breadcrumb_link?(county, active)
|
125
|
+
links[county_subdivision.name] = county_subdivision_path(county_subdivision) if breadcrumb_link?(county_subdivision, active)
|
126
|
+
links[place.name] = place_path(place) if breadcrumb_link?(place, active)
|
127
|
+
links[zcta.name] = zcta_path(zcta) if breadcrumb_link?(zcta, active)
|
128
|
+
|
129
|
+
links
|
130
|
+
end
|
131
|
+
|
132
|
+
private
|
133
|
+
|
134
|
+
def breadcrumb_link?(object, active)
|
135
|
+
object&.persisted? && object != active
|
136
|
+
end
|
137
|
+
end
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<table class="table table-striped sortable">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>GEOID</th>
|
5
|
+
<th>Name</th>
|
6
|
+
<%= demographics_headers %>
|
7
|
+
</th>
|
8
|
+
</thead>
|
9
|
+
<tbody>
|
10
|
+
<% combined_statistical_areas.each do |combined_statistical_area| %>
|
11
|
+
<tr>
|
12
|
+
<td><%= combined_statistical_area.geoid %></td>
|
13
|
+
<td><%= link_to combined_statistical_area.name, combined_statistical_area_path(combined_statistical_area) %></td>
|
14
|
+
<%= demographics_cells(combined_statistical_area, round_area: 0) %>
|
15
|
+
</tr>
|
16
|
+
<% end %>
|
17
|
+
</tbody>
|
18
|
+
</table>
|
@@ -0,0 +1,52 @@
|
|
1
|
+
<%= breadcrumbs @combined_statistical_area.name, active: @combined_statistical_area %>
|
2
|
+
|
3
|
+
<h1><%= @combined_statistical_area.name %></h1>
|
4
|
+
|
5
|
+
<table class="table table-striped">
|
6
|
+
<tbody>
|
7
|
+
<tr>
|
8
|
+
<th>GEOID</th>
|
9
|
+
<td><%= @combined_statistical_area.geoid %></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<th>Short Name</th>
|
13
|
+
<td><%= @combined_statistical_area.short_name %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<th>Population</th>
|
17
|
+
<td><%= formatted_number(@combined_statistical_area.population) %></td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<th>Housing Units</th>
|
21
|
+
<td><%= formatted_number(@combined_statistical_area.housing_units) %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<th>Land Area (mi<sup>2</sup>)</th>
|
25
|
+
<td><%= formatted_number(@combined_statistical_area.land_area, round: 0) %></td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<th>Water Area (mi<sup>2</sup>)</th>
|
29
|
+
<td><%= formatted_number(@combined_statistical_area.water_area, round: 0) %></td>
|
30
|
+
</tr>
|
31
|
+
</tbody>
|
32
|
+
</table>
|
33
|
+
|
34
|
+
<br>
|
35
|
+
|
36
|
+
<h2><%= pluralize(@combined_statistical_area.core_based_statistical_areas.count, "Core Based Statistical Areas") %></h2>
|
37
|
+
|
38
|
+
<%= render "core_based_statistical_areas/table", core_based_statistical_areas: @combined_statistical_area.core_based_statistical_areas, combined_statistical_area: @combined_statistical_area %>
|
39
|
+
|
40
|
+
<% if @combined_statistical_area.metropolitan_divisions.present? %>
|
41
|
+
<br>
|
42
|
+
|
43
|
+
<h2><%= pluralize(@combined_statistical_area.metropolitan_divisions.count, "Metropolitan Divisions") %></h2>
|
44
|
+
|
45
|
+
<%= render "metropolitan_divisions/table", metropolitan_divisions: @combined_statistical_area.metropolitan_divisions, combined_statistical_area: @combined_statistical_area %>
|
46
|
+
<% end %>
|
47
|
+
|
48
|
+
<br>
|
49
|
+
|
50
|
+
<h2><%= pluralize(@combined_statistical_area.counties.count, "County") %></h2>
|
51
|
+
|
52
|
+
<%= render "counties/table", counties: @combined_statistical_area.counties, combined_statistical_area: @combined_statistical_area %>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<table class="table table-striped sortable">
|
2
|
+
<thead>
|
3
|
+
<tr>
|
4
|
+
<th>GEOID</th>
|
5
|
+
<th>Name</th>
|
6
|
+
<th>Type</th>
|
7
|
+
<% unless defined?(combined_statistical_area) && combined_statistical_area %>
|
8
|
+
<th>Combined Statistical Area</th>
|
9
|
+
<% end %>
|
10
|
+
<%= demographics_headers %>
|
11
|
+
</th>
|
12
|
+
</thead>
|
13
|
+
<tbody>
|
14
|
+
<% core_based_statistical_areas.each do |core_based_statistical_area| %>
|
15
|
+
<tr>
|
16
|
+
<td><%= core_based_statistical_area.geoid %></td>
|
17
|
+
<td><%= link_to core_based_statistical_area.name, core_based_statistical_area_path(core_based_statistical_area, breadcrumb_params) %></td>
|
18
|
+
<td><%= core_based_statistical_area.metropolitan? ? "Metropolitan" : "Micropolitan" %> Area</td>
|
19
|
+
<% unless defined?(combined_statistical_area) && combined_statistical_area %>
|
20
|
+
<td>
|
21
|
+
<% if core_based_statistical_area.combined_statistical_area %>
|
22
|
+
<%= link_to core_based_statistical_area.combined_statistical_area.name, combined_statistical_area_path(core_based_statistical_area.combined_statistical_area) %>
|
23
|
+
<% else %>
|
24
|
+
-
|
25
|
+
<% end %>
|
26
|
+
</td>
|
27
|
+
<% end %>
|
28
|
+
<%= demographics_cells(core_based_statistical_area, round_area: 0) %>
|
29
|
+
</tr>
|
30
|
+
<% end %>
|
31
|
+
</tbody>
|
32
|
+
</table>
|
@@ -0,0 +1,19 @@
|
|
1
|
+
<%= breadcrumbs "Core Based Statistical Areas" %>
|
2
|
+
|
3
|
+
<ul class="nav nav-tabs">
|
4
|
+
<li class="nav-item">
|
5
|
+
<%= link_to "All", core_based_statistical_areas_path(breadcrumb_params.merge(tab: nil)), class: "nav-link #{'active' if @tab.blank?}" %>
|
6
|
+
</li>
|
7
|
+
<li class="nav-item">
|
8
|
+
<%= link_to "Metropolitan Areas", core_based_statistical_areas_path(breadcrumb_params.merge(tab: "metropolitan")), class: "nav-link #{'active' if @tab == 'metropolitan'}" %>
|
9
|
+
</li>
|
10
|
+
<li class="nav-item">
|
11
|
+
<%= link_to "Micropolitan Areas", core_based_statistical_areas_path(breadcrumb_params.merge(tab: "micropolitan")), class: "nav-link #{'active' if @tab == 'micropolitan'}" %>
|
12
|
+
</li>
|
13
|
+
</ul>
|
14
|
+
|
15
|
+
<h1>
|
16
|
+
<%= pluralize @core_based_statistical_areas.size, "Core Based Statistical Area" %>
|
17
|
+
</h1>
|
18
|
+
|
19
|
+
<%= render "table", core_based_statistical_areas: @core_based_statistical_areas, combined_statistical_area: @combined_statistical_area %>
|
@@ -0,0 +1,60 @@
|
|
1
|
+
<%= breadcrumbs @core_based_statistical_area.name, active: @core_based_statistical_area %>
|
2
|
+
|
3
|
+
<h1><%= @core_based_statistical_area.name %></h1>
|
4
|
+
|
5
|
+
<table class="table table-striped">
|
6
|
+
<tbody>
|
7
|
+
<tr>
|
8
|
+
<th>GEOID</th>
|
9
|
+
<td><%= @core_based_statistical_area.geoid %></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<th>Short Name</th>
|
13
|
+
<td><%= @core_based_statistical_area.short_name %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<th>Type</th>
|
17
|
+
<td><%= @core_based_statistical_area.metropolitan? ? "Metropolitan" : "Micropolitan" %> Area</td>
|
18
|
+
</tr>
|
19
|
+
<% if @core_based_statistical_area.combined_statistical_area %>
|
20
|
+
<tr>
|
21
|
+
<th>Combined Statistical Area</th>
|
22
|
+
<td><%= link_to @core_based_statistical_area.combined_statistical_area.name, combined_statistical_area_path(@core_based_statistical_area.combined_statistical_area) %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
<tr>
|
26
|
+
<th>Population</th>
|
27
|
+
<td><%= formatted_number(@core_based_statistical_area.population) %></td>
|
28
|
+
</tr>
|
29
|
+
<tr>
|
30
|
+
<th>Housing Units</th>
|
31
|
+
<td><%= formatted_number(@core_based_statistical_area.housing_units) %></td>
|
32
|
+
</tr>
|
33
|
+
<tr>
|
34
|
+
<th>Land Area (mi<sup>2</sup>)</th>
|
35
|
+
<td><%= formatted_number(@core_based_statistical_area.land_area, round: 0) %></td>
|
36
|
+
</tr>
|
37
|
+
<tr>
|
38
|
+
<th>Water Area (mi<sup>2</sup>)</th>
|
39
|
+
<td><%= formatted_number(@core_based_statistical_area.water_area, round: 0) %></td>
|
40
|
+
</tr>
|
41
|
+
<tr>
|
42
|
+
<th>Coordinates</th>
|
43
|
+
<td><%= google_maps_link(@core_based_statistical_area) %></td>
|
44
|
+
</tr>
|
45
|
+
</tbody>
|
46
|
+
</table>
|
47
|
+
|
48
|
+
<% if @core_based_statistical_area.metropolitan_divisions.present? %>
|
49
|
+
<br>
|
50
|
+
|
51
|
+
<h2><%= pluralize(@core_based_statistical_area.metropolitan_divisions.count, "Metropolitan Divisions") %></h2>
|
52
|
+
|
53
|
+
<%= render "metropolitan_divisions/table", metropolitan_divisions: @core_based_statistical_area.metropolitan_divisions, core_based_statistical_area: @core_based_statistical_area %>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
<br>
|
57
|
+
|
58
|
+
<h2><%= pluralize(@core_based_statistical_area.counties.count, "County") %></h2>
|
59
|
+
|
60
|
+
<%= render "counties/table", counties: @core_based_statistical_area.counties, core_based_statistical_area: @core_based_statistical_area %>
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<%
|
2
|
+
urban_area ||= nil
|
3
|
+
zcta ||= nil
|
4
|
+
overlap = (urban_area || zcta)
|
5
|
+
%>
|
6
|
+
|
7
|
+
<table class="table table-striped sortable">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>GEOID</th>
|
11
|
+
<th>Name</th>
|
12
|
+
<% unless defined?(state) && state %>
|
13
|
+
<th>State</th>
|
14
|
+
<% end %>
|
15
|
+
<% unless defined?(core_based_statistical_area) && core_based_statistical_area %>
|
16
|
+
<th>Core Based Statistical Area</th>
|
17
|
+
<% else %>
|
18
|
+
<th>CBSA Position</th>
|
19
|
+
<% end %>
|
20
|
+
<th>FIPS Class Code</th>
|
21
|
+
|
22
|
+
<%= demographics_headers %>
|
23
|
+
|
24
|
+
<% if overlap %>
|
25
|
+
<th class="text-end">Overlap</th>
|
26
|
+
<% end %>
|
27
|
+
</th>
|
28
|
+
</thead>
|
29
|
+
<tbody>
|
30
|
+
<% counties.each do |county| %>
|
31
|
+
<tr>
|
32
|
+
<td><%= county.geoid %></td>
|
33
|
+
<td><%= link_to county.name, county_path(county, breadcrumb_params) %></td>
|
34
|
+
<% unless defined?(state) && state %>
|
35
|
+
<td><%= county.state.name %></td>
|
36
|
+
<% end %>
|
37
|
+
<% if defined?(core_based_statistical_area) && core_based_statistical_area %>
|
38
|
+
<td><%= county.central? ? "Central" : "Outlying" %></td>
|
39
|
+
<% else %>
|
40
|
+
<td>
|
41
|
+
<% if county.core_based_statistical_area %>
|
42
|
+
<%= link_to county.core_based_statistical_area.name, core_based_statistical_area_path(county.core_based_statistical_area) %>
|
43
|
+
<% else %>
|
44
|
+
-
|
45
|
+
<% end %>
|
46
|
+
</td>
|
47
|
+
<% end %>
|
48
|
+
<td><%= county.fips_class_code %></td>
|
49
|
+
|
50
|
+
<%= demographics_cells(county, round_area: 0) %>
|
51
|
+
|
52
|
+
<% if overlap %>
|
53
|
+
<td class="text-end">
|
54
|
+
<% if urban_area %>
|
55
|
+
<%= overlap_percentage(urban_area, county, :urban_area_counties) %>
|
56
|
+
<% elsif zcta %>
|
57
|
+
<%= overlap_percentage(zcta, county, :zcta_counties) %>
|
58
|
+
<% end %>
|
59
|
+
</td>
|
60
|
+
<% end %>
|
61
|
+
</tr>
|
62
|
+
<% end %>
|
63
|
+
</tbody>
|
64
|
+
</table>
|
@@ -0,0 +1,96 @@
|
|
1
|
+
<%= breadcrumbs @county.full_name, active: @county %>
|
2
|
+
|
3
|
+
<h1><%= @county.name %></h1>
|
4
|
+
|
5
|
+
<table class="table table-striped">
|
6
|
+
<tbody>
|
7
|
+
<tr>
|
8
|
+
<th>GEOID</th>
|
9
|
+
<td><%= @county.geoid %></td>
|
10
|
+
</tr>
|
11
|
+
<tr>
|
12
|
+
<th>Short Name</th>
|
13
|
+
<td><%= @county.short_name %></td>
|
14
|
+
</tr>
|
15
|
+
<tr>
|
16
|
+
<th>State</th>
|
17
|
+
<td><%= link_to @county.state.name, state_path(@county.state, breadcrumb_params) %></td>
|
18
|
+
</tr>
|
19
|
+
<tr>
|
20
|
+
<th>FIP Class Code</th>
|
21
|
+
<td><%= @county.fips_class_code %></td>
|
22
|
+
</tr>
|
23
|
+
<tr>
|
24
|
+
<th>Time Zone</th>
|
25
|
+
<td><%= @county&.time_zones.collect(&:name).join(", ") %></td>
|
26
|
+
</tr>
|
27
|
+
<% if @county.combined_statistical_area %>
|
28
|
+
<tr>
|
29
|
+
<th>Combined Statistical Area</th>
|
30
|
+
<td><%= link_to @county.combined_statistical_area.name, combined_statistical_area_path(@county.combined_statistical_area, breadcrumb_params) %></td>
|
31
|
+
</tr>
|
32
|
+
<% end %>
|
33
|
+
<% if @county.core_based_statistical_area %>
|
34
|
+
<tr>
|
35
|
+
<th>Core Based Statistical Area</th>
|
36
|
+
<td><%= link_to @county.core_based_statistical_area.name, core_based_statistical_area_path(@county.core_based_statistical_area, breadcrumb_params) %></td>
|
37
|
+
</tr>
|
38
|
+
<% end %>
|
39
|
+
<% if @county.metropolitan_division %>
|
40
|
+
<tr>
|
41
|
+
<th>Metropolitan Division</th>
|
42
|
+
<td><%= link_to @county.metropolitan_division.name, metropolitan_division_path(@county.metropolitan_division, breadcrumb_params) %></td>
|
43
|
+
</tr>
|
44
|
+
<% end %>
|
45
|
+
<tr>
|
46
|
+
<th>Population</th>
|
47
|
+
<td><%= formatted_number(@county.population) %></td>
|
48
|
+
</tr>
|
49
|
+
<tr>
|
50
|
+
<th>Population Density</th>
|
51
|
+
<td><%= population_density(@county) %></td>
|
52
|
+
</tr>
|
53
|
+
<tr>
|
54
|
+
<th>Housing Units</th>
|
55
|
+
<td><%= formatted_number(@county.housing_units) %></td>
|
56
|
+
</tr>
|
57
|
+
<tr>
|
58
|
+
<th>Land Area (mi<sup>2</sup>)</th>
|
59
|
+
<td><%= formatted_number(@county.land_area, round: 0) %></td>
|
60
|
+
</tr>
|
61
|
+
<tr>
|
62
|
+
<th>Water Area (mi<sup>2</sup>)</th>
|
63
|
+
<td><%= formatted_number(@county.water_area, round: 0) %></td>
|
64
|
+
</tr>
|
65
|
+
<tr>
|
66
|
+
<th>Coordinates</th>
|
67
|
+
<td><%= google_maps_link(@county) %></td>
|
68
|
+
</tr>
|
69
|
+
</tbody>
|
70
|
+
</table>
|
71
|
+
|
72
|
+
<% if @county.urban_areas.present? %>
|
73
|
+
<br>
|
74
|
+
|
75
|
+
<h2><%= pluralize(@county.urban_areas.count, "Urban Area") %></h2>
|
76
|
+
|
77
|
+
<%= render "urban_areas/table", urban_areas: @county.urban_areas, county: @county %>
|
78
|
+
<% end %>
|
79
|
+
|
80
|
+
<br>
|
81
|
+
|
82
|
+
<h2><%= pluralize(@county.subdivisions.count, "County Subdivision") %></h2>
|
83
|
+
|
84
|
+
<%= render "county_subdivisions/table", county_subdivisions: @county.subdivisions, county: @county %>
|
85
|
+
|
86
|
+
<br>
|
87
|
+
|
88
|
+
<h2><%= pluralize(@county.places.count, "Place") %></h2>
|
89
|
+
|
90
|
+
<%= render "places/table", places: @county.places, county: @county %>
|
91
|
+
|
92
|
+
<br>
|
93
|
+
|
94
|
+
<h2><%= pluralize(@county.zctas.count, "ZIP Code Tabulation Area") %></h2>
|
95
|
+
|
96
|
+
<%= render "zctas/table", zctas: @county.zctas, county: @county %>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<%
|
2
|
+
urban_area ||= nil
|
3
|
+
zcta ||= nil
|
4
|
+
overlap = (urban_area || zcta)
|
5
|
+
%>
|
6
|
+
|
7
|
+
<table class="table table-striped sortable">
|
8
|
+
<thead>
|
9
|
+
<tr>
|
10
|
+
<th>GEOID</th>
|
11
|
+
<th>Name</th>
|
12
|
+
<% unless defined?(county) && county %>
|
13
|
+
<th>County</th>
|
14
|
+
<% end %>
|
15
|
+
<th>FIPS Class Code</th>
|
16
|
+
|
17
|
+
<%= demographics_headers %>
|
18
|
+
|
19
|
+
<% if overlap %>
|
20
|
+
<th class="text-end">Overlap</th>
|
21
|
+
<% end %>
|
22
|
+
</th>
|
23
|
+
</thead>
|
24
|
+
<tbody>
|
25
|
+
<% county_subdivisions.each do |county_subdivision| %>
|
26
|
+
<tr>
|
27
|
+
<td><%= county_subdivision.geoid %></td>
|
28
|
+
<td><%= link_to county_subdivision.name, county_subdivision_path(county_subdivision, breadcrumb_params) %></td>
|
29
|
+
<% unless defined?(county) && county %>
|
30
|
+
<td><%= link_to county_subdivision.county.full_name, county_path(county_subdivision.county, breadcrumb_params) %></td>
|
31
|
+
<% end %>
|
32
|
+
<td><%= county_subdivision.fips_class_code %></td>
|
33
|
+
|
34
|
+
<%= demographics_cells(county_subdivision, round_area: 1) %>
|
35
|
+
|
36
|
+
<% if overlap %>
|
37
|
+
<td class="text-end">
|
38
|
+
<% if urban_area %>
|
39
|
+
<%= overlap_percentage(urban_area, county_subdivision, :urban_area_county_subdivisions) %>
|
40
|
+
<% elsif zcta %>
|
41
|
+
<%= overlap_percentage(zcta, county_subdivision, :zcta_county_subdivisions) %>
|
42
|
+
<% end %>
|
43
|
+
</td>
|
44
|
+
<% end %>
|
45
|
+
</tr>
|
46
|
+
<% end %>
|
47
|
+
</tbody>
|
48
|
+
</table>
|