us_geo 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/README.md +2 -0
- data/VERSION +1 -1
- data/db/schema.rb +5 -1
- data/explorer_app/Gemfile.lock +344 -0
- data/explorer_app/app/views/zctas/show.html.erb +10 -0
- data/lib/tasks/us_geo/us_geo.rake +5 -7
- data/lib/us_geo/area.rb +1 -1
- data/lib/us_geo/base_record.rb +1 -1
- data/lib/us_geo/combined_statistical_area.rb +1 -0
- data/lib/us_geo/county_subdivision.rb +5 -1
- data/lib/us_geo/state.rb +0 -4
- data/lib/us_geo/urban_area.rb +2 -2
- data/lib/us_geo/urban_area_county.rb +4 -4
- data/lib/us_geo/urban_area_county_subdivision.rb +6 -6
- data/lib/us_geo/zcta.rb +22 -0
- data/lib/us_geo/zcta_county.rb +4 -4
- data/lib/us_geo/zcta_county_subdivision.rb +4 -4
- data/lib/us_geo/zcta_place.rb +8 -16
- data/lib/us_geo/zcta_urban_area.rb +4 -4
- data/lib/us_geo.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 82fdb1c898a2418d36e688ac330574627a8bdf91907da3f6b3ff0d07468c8e16
|
|
4
|
+
data.tar.gz: 03ca9f21708193790500d6d0319906d70e531349b5b269b37fb59c8731552799
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1e6698c42195ba9e80e28ce9c7c7311a92ef4ab69ece75cfeb57a26fc5e640f56bb7fd7637abf7a938311511d2e3b177ab35ff19d1f4e5e668b3b5fa01558474
|
|
7
|
+
data.tar.gz: 91bae4b904d7041570db5ee53a473ac453cf8a20927c4246390109a88a97bf6a9636412576de5e07bddbf83a86773cf2af6aa0d1f2b28db44c1a8228b618fee2
|
data/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## 2.3.0
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Fixed default data URL to point to the `main` branch on GitHub instead of the old `master` branch. The files on the `master` branch have not been updated since version 2.0.0.
|
|
12
|
+
- Fixed `TypeError` raised by `USGeo::ZctaPlace#percent_place_land_area` and `#percent_place_total_area` when the place does not have a land area (i.e. the U6 FIPS classification places added in version 2.2.0). The `percent_*` methods on all join models now return `nil` instead of raising an error or returning `NaN`/`Infinity` when the denominator is missing or zero.
|
|
13
|
+
- Fixed the `us_geo:import:dump_removed` rake task which raised a `NameError` and did not produce valid JSON output.
|
|
14
|
+
- Added `USGeo::ZctaMapping` to the import rake tasks. Previously `us_geo:import:all` did not load the ZCTA mappings data needed by `USGeo::Zcta.for_zipcode`, and the `removed_counts`, `dump_removed`, and `cleanup` tasks did not include it. It can now also be loaded individually with `us_geo:import:zcta_mappings`.
|
|
15
|
+
- Removed the `delegate :region, to: :division` on `USGeo::State` which was shadowing the `belongs_to :region` association reader so that the `region_id` attribute was never used.
|
|
16
|
+
- Removed the unimplemented `gzipped` keyword argument from the abstract `USGeo::BaseRecord.load!` method signature to match the subclass implementations.
|
|
17
|
+
- Renaming duplicate county subdivisions during import now includes the geoid in the new name and respects the 60 character limit on names so that the rename cannot fail validation.
|
|
18
|
+
- Updated `db/schema.rb` to include the `usps_locality` and `usps_state_code` columns on ZCTA's and the indexes on the ZCTA primary place and county subdivision geoid columns.
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
|
|
22
|
+
- `USGeo::Zcta#usps_locality` and `USGeo::Zcta#usps_state_code` are now populated by `USGeo::Zcta.load!` with the city and state that the U.S. Postal Service delivers mail to for the ZIP code. The columns were added to the schema in version 2.2.0, but were never populated. They are `nil` for ZIP codes that the Postal Service does not deliver mail to. Note that `zctas.csv` gained `USPS Locality` and `USPS State Code` columns, so the data files must be reimported to pick up the new values.
|
|
23
|
+
- `USGeo::CombinedStatisticalArea` now validates presence and uniqueness of `short_name`, and `USGeo::UrbanArea` now validates presence of `name` and `short_name`, matching the database constraints.
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
|
|
27
|
+
- Removed `USGeo::ZctaPlace#percent_zcta_population` and `#percent_place_population`. These methods were supposed to have been removed in version 2.0 along with the other population methods on the join models (see UPDATING_TO_VERSION_2.md). They raised `NameError` on databases created with the version 2 migrations since the population column no longer exists.
|
|
28
|
+
|
|
7
29
|
## 2.2.0
|
|
8
30
|
|
|
9
31
|
### Added
|
data/README.md
CHANGED
|
@@ -139,12 +139,14 @@ rails us_geo:import:county_subdivisions
|
|
|
139
139
|
rails us_geo:import:urban_areas
|
|
140
140
|
rails us_geo:import:places
|
|
141
141
|
rails us_geo:import:zctas
|
|
142
|
+
rails us_geo:import:zcta_mappings
|
|
142
143
|
rails us_geo:import:urban_area_counties
|
|
143
144
|
rails us_geo:import:urban_area_county_subdivisions
|
|
144
145
|
rails us_geo:import:place_counties
|
|
145
146
|
rails us_geo:import:zcta_counties
|
|
146
147
|
rails us_geo:import:zcta_county_subdivisions
|
|
147
148
|
rails us_geo:import:zcta_places
|
|
149
|
+
rails us_geo:import:zcta_urban_areas
|
|
148
150
|
```
|
|
149
151
|
|
|
150
152
|
By default this will download the data from files hosted with the project on GitHub and insert/update into the database. If any entity records are found that don't exist in the data files, the `removed` flag on the database rows will be set to `TRUE`.
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.3.0
|
data/db/schema.rb
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#
|
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
|
12
12
|
|
|
13
|
-
ActiveRecord::Schema[7.0].define(version:
|
|
13
|
+
ActiveRecord::Schema[7.0].define(version: 2025_10_29_215800) do
|
|
14
14
|
create_table "us_geo_combined_statistical_areas", primary_key: "geoid", id: { type: :string, limit: 3 }, force: :cascade do |t|
|
|
15
15
|
t.string "name", limit: 60, null: false
|
|
16
16
|
t.float "land_area", null: false
|
|
@@ -296,7 +296,11 @@ ActiveRecord::Schema[7.0].define(version: 2023_04_21_004258) do
|
|
|
296
296
|
t.integer "status", limit: 1, default: 0, null: false
|
|
297
297
|
t.string "primary_place_geoid", limit: 7
|
|
298
298
|
t.string "primary_county_subdivision_geoid", limit: 10
|
|
299
|
+
t.string "usps_locality", limit: 30
|
|
300
|
+
t.string "usps_state_code", limit: 2
|
|
299
301
|
t.index ["primary_county_geoid"], name: "index_us_geo_zctas_on_primary_county_geoid"
|
|
302
|
+
t.index ["primary_county_subdivision_geoid"], name: "index_us_geo_zctas_on_primary_county_subdivision_geoid"
|
|
303
|
+
t.index ["primary_place_geoid"], name: "index_us_geo_zctas_on_primary_place_geoid"
|
|
300
304
|
t.index ["primary_urban_area_geoid"], name: "index_us_geo_zctas_on_primary_urban_area_geoid"
|
|
301
305
|
end
|
|
302
306
|
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: ..
|
|
3
|
+
specs:
|
|
4
|
+
us_geo (2.3.0)
|
|
5
|
+
activerecord (>= 5.2)
|
|
6
|
+
csv
|
|
7
|
+
|
|
8
|
+
GEM
|
|
9
|
+
remote: https://rubygems.org/
|
|
10
|
+
specs:
|
|
11
|
+
action_text-trix (2.1.19)
|
|
12
|
+
railties
|
|
13
|
+
actioncable (8.1.3)
|
|
14
|
+
actionpack (= 8.1.3)
|
|
15
|
+
activesupport (= 8.1.3)
|
|
16
|
+
nio4r (~> 2.0)
|
|
17
|
+
websocket-driver (>= 0.6.1)
|
|
18
|
+
zeitwerk (~> 2.6)
|
|
19
|
+
actionmailbox (8.1.3)
|
|
20
|
+
actionpack (= 8.1.3)
|
|
21
|
+
activejob (= 8.1.3)
|
|
22
|
+
activerecord (= 8.1.3)
|
|
23
|
+
activestorage (= 8.1.3)
|
|
24
|
+
activesupport (= 8.1.3)
|
|
25
|
+
mail (>= 2.8.0)
|
|
26
|
+
actionmailer (8.1.3)
|
|
27
|
+
actionpack (= 8.1.3)
|
|
28
|
+
actionview (= 8.1.3)
|
|
29
|
+
activejob (= 8.1.3)
|
|
30
|
+
activesupport (= 8.1.3)
|
|
31
|
+
mail (>= 2.8.0)
|
|
32
|
+
rails-dom-testing (~> 2.2)
|
|
33
|
+
actionpack (8.1.3)
|
|
34
|
+
actionview (= 8.1.3)
|
|
35
|
+
activesupport (= 8.1.3)
|
|
36
|
+
nokogiri (>= 1.8.5)
|
|
37
|
+
rack (>= 2.2.4)
|
|
38
|
+
rack-session (>= 1.0.1)
|
|
39
|
+
rack-test (>= 0.6.3)
|
|
40
|
+
rails-dom-testing (~> 2.2)
|
|
41
|
+
rails-html-sanitizer (~> 1.6)
|
|
42
|
+
useragent (~> 0.16)
|
|
43
|
+
actiontext (8.1.3)
|
|
44
|
+
action_text-trix (~> 2.1.15)
|
|
45
|
+
actionpack (= 8.1.3)
|
|
46
|
+
activerecord (= 8.1.3)
|
|
47
|
+
activestorage (= 8.1.3)
|
|
48
|
+
activesupport (= 8.1.3)
|
|
49
|
+
globalid (>= 0.6.0)
|
|
50
|
+
nokogiri (>= 1.8.5)
|
|
51
|
+
actionview (8.1.3)
|
|
52
|
+
activesupport (= 8.1.3)
|
|
53
|
+
builder (~> 3.1)
|
|
54
|
+
erubi (~> 1.11)
|
|
55
|
+
rails-dom-testing (~> 2.2)
|
|
56
|
+
rails-html-sanitizer (~> 1.6)
|
|
57
|
+
activejob (8.1.3)
|
|
58
|
+
activesupport (= 8.1.3)
|
|
59
|
+
globalid (>= 0.3.6)
|
|
60
|
+
activemodel (8.1.3)
|
|
61
|
+
activesupport (= 8.1.3)
|
|
62
|
+
activerecord (8.1.3)
|
|
63
|
+
activemodel (= 8.1.3)
|
|
64
|
+
activesupport (= 8.1.3)
|
|
65
|
+
timeout (>= 0.4.0)
|
|
66
|
+
activestorage (8.1.3)
|
|
67
|
+
actionpack (= 8.1.3)
|
|
68
|
+
activejob (= 8.1.3)
|
|
69
|
+
activerecord (= 8.1.3)
|
|
70
|
+
activesupport (= 8.1.3)
|
|
71
|
+
marcel (~> 1.0)
|
|
72
|
+
activesupport (8.1.3)
|
|
73
|
+
base64
|
|
74
|
+
bigdecimal
|
|
75
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
|
76
|
+
connection_pool (>= 2.2.5)
|
|
77
|
+
drb
|
|
78
|
+
i18n (>= 1.6, < 2)
|
|
79
|
+
json
|
|
80
|
+
logger (>= 1.4.2)
|
|
81
|
+
minitest (>= 5.1)
|
|
82
|
+
securerandom (>= 0.3)
|
|
83
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
|
84
|
+
uri (>= 0.13.1)
|
|
85
|
+
base64 (0.3.0)
|
|
86
|
+
bigdecimal (4.1.2)
|
|
87
|
+
bindex (0.8.1)
|
|
88
|
+
builder (3.3.0)
|
|
89
|
+
concurrent-ruby (1.3.7)
|
|
90
|
+
connection_pool (3.0.2)
|
|
91
|
+
crass (1.0.7)
|
|
92
|
+
csv (3.3.5)
|
|
93
|
+
date (3.5.1)
|
|
94
|
+
debug (1.11.1)
|
|
95
|
+
irb (~> 1.10)
|
|
96
|
+
reline (>= 0.3.8)
|
|
97
|
+
drb (2.2.3)
|
|
98
|
+
erb (6.0.4)
|
|
99
|
+
erubi (1.13.1)
|
|
100
|
+
globalid (1.4.0)
|
|
101
|
+
activesupport (>= 6.1)
|
|
102
|
+
i18n (1.15.2)
|
|
103
|
+
concurrent-ruby (~> 1.0)
|
|
104
|
+
io-console (0.8.2)
|
|
105
|
+
irb (1.18.0)
|
|
106
|
+
pp (>= 0.6.0)
|
|
107
|
+
prism (>= 1.3.0)
|
|
108
|
+
rdoc (>= 4.0.0)
|
|
109
|
+
reline (>= 0.4.2)
|
|
110
|
+
json (2.20.0)
|
|
111
|
+
logger (1.7.0)
|
|
112
|
+
loofah (2.25.1)
|
|
113
|
+
crass (~> 1.0.2)
|
|
114
|
+
nokogiri (>= 1.12.0)
|
|
115
|
+
mail (2.9.1)
|
|
116
|
+
logger
|
|
117
|
+
mini_mime (>= 0.1.1)
|
|
118
|
+
net-imap
|
|
119
|
+
net-pop
|
|
120
|
+
net-smtp
|
|
121
|
+
marcel (1.2.1)
|
|
122
|
+
mini_mime (1.1.5)
|
|
123
|
+
minitest (6.0.6)
|
|
124
|
+
drb (~> 2.0)
|
|
125
|
+
prism (~> 1.5)
|
|
126
|
+
net-imap (0.6.4.1)
|
|
127
|
+
date
|
|
128
|
+
net-protocol
|
|
129
|
+
net-pop (0.1.2)
|
|
130
|
+
net-protocol
|
|
131
|
+
net-protocol (0.2.2)
|
|
132
|
+
timeout
|
|
133
|
+
net-smtp (0.5.1)
|
|
134
|
+
net-protocol
|
|
135
|
+
nio4r (2.7.5)
|
|
136
|
+
nokogiri (1.19.4-aarch64-linux-gnu)
|
|
137
|
+
racc (~> 1.4)
|
|
138
|
+
nokogiri (1.19.4-aarch64-linux-musl)
|
|
139
|
+
racc (~> 1.4)
|
|
140
|
+
nokogiri (1.19.4-arm-linux-gnu)
|
|
141
|
+
racc (~> 1.4)
|
|
142
|
+
nokogiri (1.19.4-arm-linux-musl)
|
|
143
|
+
racc (~> 1.4)
|
|
144
|
+
nokogiri (1.19.4-arm64-darwin)
|
|
145
|
+
racc (~> 1.4)
|
|
146
|
+
nokogiri (1.19.4-x86_64-darwin)
|
|
147
|
+
racc (~> 1.4)
|
|
148
|
+
nokogiri (1.19.4-x86_64-linux-gnu)
|
|
149
|
+
racc (~> 1.4)
|
|
150
|
+
nokogiri (1.19.4-x86_64-linux-musl)
|
|
151
|
+
racc (~> 1.4)
|
|
152
|
+
pp (0.6.4)
|
|
153
|
+
prettyprint
|
|
154
|
+
prettyprint (0.2.0)
|
|
155
|
+
prism (1.9.0)
|
|
156
|
+
puma (7.2.1)
|
|
157
|
+
nio4r (~> 2.0)
|
|
158
|
+
racc (1.8.1)
|
|
159
|
+
rack (3.2.6)
|
|
160
|
+
rack-session (2.1.2)
|
|
161
|
+
base64 (>= 0.1.0)
|
|
162
|
+
rack (>= 3.0.0)
|
|
163
|
+
rack-test (2.2.0)
|
|
164
|
+
rack (>= 1.3)
|
|
165
|
+
rackup (2.3.1)
|
|
166
|
+
rack (>= 3)
|
|
167
|
+
rails (8.1.3)
|
|
168
|
+
actioncable (= 8.1.3)
|
|
169
|
+
actionmailbox (= 8.1.3)
|
|
170
|
+
actionmailer (= 8.1.3)
|
|
171
|
+
actionpack (= 8.1.3)
|
|
172
|
+
actiontext (= 8.1.3)
|
|
173
|
+
actionview (= 8.1.3)
|
|
174
|
+
activejob (= 8.1.3)
|
|
175
|
+
activemodel (= 8.1.3)
|
|
176
|
+
activerecord (= 8.1.3)
|
|
177
|
+
activestorage (= 8.1.3)
|
|
178
|
+
activesupport (= 8.1.3)
|
|
179
|
+
bundler (>= 1.15.0)
|
|
180
|
+
railties (= 8.1.3)
|
|
181
|
+
rails-dom-testing (2.3.0)
|
|
182
|
+
activesupport (>= 5.0.0)
|
|
183
|
+
minitest
|
|
184
|
+
nokogiri (>= 1.6)
|
|
185
|
+
rails-html-sanitizer (1.7.0)
|
|
186
|
+
loofah (~> 2.25)
|
|
187
|
+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
|
|
188
|
+
railties (8.1.3)
|
|
189
|
+
actionpack (= 8.1.3)
|
|
190
|
+
activesupport (= 8.1.3)
|
|
191
|
+
irb (~> 1.13)
|
|
192
|
+
rackup (>= 1.0.0)
|
|
193
|
+
rake (>= 12.2)
|
|
194
|
+
thor (~> 1.0, >= 1.2.2)
|
|
195
|
+
tsort (>= 0.2)
|
|
196
|
+
zeitwerk (~> 2.6)
|
|
197
|
+
rake (13.4.2)
|
|
198
|
+
rbs (4.0.3)
|
|
199
|
+
logger
|
|
200
|
+
prism (>= 1.6.0)
|
|
201
|
+
tsort
|
|
202
|
+
rdoc (8.0.0)
|
|
203
|
+
erb
|
|
204
|
+
prism (>= 1.6.0)
|
|
205
|
+
rbs (>= 4.0.0)
|
|
206
|
+
tsort
|
|
207
|
+
reline (0.6.3)
|
|
208
|
+
io-console (~> 0.5)
|
|
209
|
+
securerandom (0.4.1)
|
|
210
|
+
sqlite3 (2.9.5-aarch64-linux-gnu)
|
|
211
|
+
sqlite3 (2.9.5-aarch64-linux-musl)
|
|
212
|
+
sqlite3 (2.9.5-arm-linux-gnu)
|
|
213
|
+
sqlite3 (2.9.5-arm-linux-musl)
|
|
214
|
+
sqlite3 (2.9.5-arm64-darwin)
|
|
215
|
+
sqlite3 (2.9.5-x86_64-darwin)
|
|
216
|
+
sqlite3 (2.9.5-x86_64-linux-gnu)
|
|
217
|
+
sqlite3 (2.9.5-x86_64-linux-musl)
|
|
218
|
+
thor (1.5.0)
|
|
219
|
+
timeout (0.6.1)
|
|
220
|
+
tsort (0.2.0)
|
|
221
|
+
tzinfo (2.0.6)
|
|
222
|
+
concurrent-ruby (~> 1.0)
|
|
223
|
+
uri (1.1.1)
|
|
224
|
+
useragent (0.16.11)
|
|
225
|
+
web-console (4.3.0)
|
|
226
|
+
actionview (>= 8.0.0)
|
|
227
|
+
bindex (>= 0.4.0)
|
|
228
|
+
railties (>= 8.0.0)
|
|
229
|
+
websocket-driver (0.8.2)
|
|
230
|
+
base64
|
|
231
|
+
websocket-extensions (>= 0.1.0)
|
|
232
|
+
websocket-extensions (0.1.5)
|
|
233
|
+
zeitwerk (2.8.2)
|
|
234
|
+
|
|
235
|
+
PLATFORMS
|
|
236
|
+
aarch64-linux-gnu
|
|
237
|
+
aarch64-linux-musl
|
|
238
|
+
arm-linux-gnu
|
|
239
|
+
arm-linux-musl
|
|
240
|
+
arm64-darwin
|
|
241
|
+
x86_64-darwin
|
|
242
|
+
x86_64-linux-gnu
|
|
243
|
+
x86_64-linux-musl
|
|
244
|
+
|
|
245
|
+
DEPENDENCIES
|
|
246
|
+
bundler
|
|
247
|
+
debug
|
|
248
|
+
puma (~> 7.1)
|
|
249
|
+
rails (~> 8.1.2, >= 8.1.2)
|
|
250
|
+
sqlite3 (~> 2.9)
|
|
251
|
+
tzinfo-data
|
|
252
|
+
us_geo!
|
|
253
|
+
web-console
|
|
254
|
+
|
|
255
|
+
CHECKSUMS
|
|
256
|
+
action_text-trix (2.1.19) sha256=7012f59421009cf284aa651294896414d653a61a2417c9b8714c8476d2f74009
|
|
257
|
+
actioncable (8.1.3) sha256=e5bc7f75e44e6a22de29c4f43176927c3a9ce4824464b74ed18d8226e75a80f0
|
|
258
|
+
actionmailbox (8.1.3) sha256=df7da474eaa0e70df4ed5a6fef66eb3b3b0f2dbf7f14518deee8d77f1b4aae59
|
|
259
|
+
actionmailer (8.1.3) sha256=831f724891bb70d0aaa4d76581a6321124b6a752cb655c9346aae5479318448d
|
|
260
|
+
actionpack (8.1.3) sha256=af998cae4d47c5d581a2cc363b5c77eb718b7c4b45748d81b1887b25621c29a3
|
|
261
|
+
actiontext (8.1.3) sha256=d291019c00e1ea9e6463011fa214f6081a56d7b9a1d224e7d3f6384c1dafc7d2
|
|
262
|
+
actionview (8.1.3) sha256=1347c88c7f3edb38100c5ce0e9fb5e62d7755f3edc1b61cce2eb0b2c6ea2fd5d
|
|
263
|
+
activejob (8.1.3) sha256=a149b1766aa8204c3c3da7309e4becd40fcd5529c348cffbf6c9b16b565fe8d3
|
|
264
|
+
activemodel (8.1.3) sha256=90c05cbe4cef3649b8f79f13016191ea94c4525ce4a5c0fb7ef909c4b91c8219
|
|
265
|
+
activerecord (8.1.3) sha256=8003be7b2466ba0a2a670e603eeb0a61dd66058fccecfc49901e775260ac70ab
|
|
266
|
+
activestorage (8.1.3) sha256=0564ce9309143951a67615e1bb4e090ee54b8befed417133cae614479b46384d
|
|
267
|
+
activesupport (8.1.3) sha256=21a5e0dfbd4c3ddd9e1317ec6a4d782fa226e7867dc70b0743acda81a1dca20e
|
|
268
|
+
base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
|
|
269
|
+
bigdecimal (4.1.2) sha256=53d217666027eab4280346fba98e7d5b66baaae1b9c3c1c0ffe89d48188a3fbd
|
|
270
|
+
bindex (0.8.1) sha256=7b1ecc9dc539ed8bccfc8cb4d2732046227b09d6f37582ff12e50a5047ceb17e
|
|
271
|
+
builder (3.3.0) sha256=497918d2f9dca528fdca4b88d84e4ef4387256d984b8154e9d5d3fe5a9c8835f
|
|
272
|
+
concurrent-ruby (1.3.7) sha256=4412caec3a5ea2e5fdc52076724c071a81f2c0593d83b2ac8cbb8ca63b3151b0
|
|
273
|
+
connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
|
|
274
|
+
crass (1.0.7) sha256=94868719948664c89ddcaf0a37c65048413dfcb1c869470a5f7a7ceb5390b295
|
|
275
|
+
csv (3.3.5) sha256=6e5134ac3383ef728b7f02725d9872934f523cb40b961479f69cf3afa6c8e73f
|
|
276
|
+
date (3.5.1) sha256=750d06384d7b9c15d562c76291407d89e368dda4d4fff957eb94962d325a0dc0
|
|
277
|
+
debug (1.11.1) sha256=2e0b0ac6119f2207a6f8ac7d4a73ca8eb4e440f64da0a3136c30343146e952b6
|
|
278
|
+
drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
|
|
279
|
+
erb (6.0.4) sha256=38e3803694be357fe2bfe312487c74beaf9fb4e5beb3e22498952fe1645b95d9
|
|
280
|
+
erubi (1.13.1) sha256=a082103b0885dbc5ecf1172fede897f9ebdb745a4b97a5e8dc63953db1ee4ad9
|
|
281
|
+
globalid (1.4.0) sha256=037f12fbf1d9d7a014d501c2d5c77356fd4ddd96d7a7991d6700bba96706f427
|
|
282
|
+
i18n (1.15.2) sha256=00f9eb62412fe593b2a65a97daa75300d37abb8f7202ec748e94b6d46a9dd1b5
|
|
283
|
+
io-console (0.8.2) sha256=d6e3ae7a7cc7574f4b8893b4fca2162e57a825b223a177b7afa236c5ef9814cc
|
|
284
|
+
irb (1.18.0) sha256=de9454a0703a54704b9811a5ef31a60c86949fbf4013fcf244fabc7c775248e3
|
|
285
|
+
json (2.20.0) sha256=9362bc6e55a952b056abf9167cf053358181c904cb70cd6eee0808ea830fc32b
|
|
286
|
+
logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
|
|
287
|
+
loofah (2.25.1) sha256=d436c73dbd0c1147b16c4a41db097942d217303e1f7728704b37e4df9f6d2e04
|
|
288
|
+
mail (2.9.1) sha256=06574eca475253d6c18145dd70af80d0eb970182d55053497c5f4d797ea160e8
|
|
289
|
+
marcel (1.2.1) sha256=1678e9360e32f9eafa917c80029e2f6d10b2715c66a4b87b6d0da9b9cd1f859f
|
|
290
|
+
mini_mime (1.1.5) sha256=8681b7e2e4215f2a159f9400b5816d85e9d8c6c6b491e96a12797e798f8bccef
|
|
291
|
+
minitest (6.0.6) sha256=153ea36d1d987a62942382b61075745042a2b3123b1cd48f4c3675af9cc7d6f1
|
|
292
|
+
net-imap (0.6.4.1) sha256=29f0360d75a7efd3539f16ac1957dea5c0a51ddeceb348db4553c3120914ea0d
|
|
293
|
+
net-pop (0.1.2) sha256=848b4e982013c15b2f0382792268763b748cce91c9e91e36b0f27ed26420dff3
|
|
294
|
+
net-protocol (0.2.2) sha256=aa73e0cba6a125369de9837b8d8ef82a61849360eba0521900e2c3713aa162a8
|
|
295
|
+
net-smtp (0.5.1) sha256=ed96a0af63c524fceb4b29b0d352195c30d82dd916a42f03c62a3a70e5b70736
|
|
296
|
+
nio4r (2.7.5) sha256=6c90168e48fb5f8e768419c93abb94ba2b892a1d0602cb06eef16d8b7df1dca1
|
|
297
|
+
nokogiri (1.19.4-aarch64-linux-gnu) sha256=1269fb644a6de405057a53dd5c762b1209b43ca7424f839454d3dbc677c31a8f
|
|
298
|
+
nokogiri (1.19.4-aarch64-linux-musl) sha256=35c65b9ce72b3bb03207bdbe7067915019dc18c1b9b59139684bd6690fdd01af
|
|
299
|
+
nokogiri (1.19.4-arm-linux-gnu) sha256=a301313e38bb065d68239e79734bcd6f56fb6efaacebde29e9abf2a4735340ca
|
|
300
|
+
nokogiri (1.19.4-arm-linux-musl) sha256=588923c101bcfa78869734d247d25b598674323e7f22474fc468f6e5647311eb
|
|
301
|
+
nokogiri (1.19.4-arm64-darwin) sha256=a46db9853286e6597b36ebc6953817d15acf3a299583eb3f89fdc6f91dd63527
|
|
302
|
+
nokogiri (1.19.4-x86_64-darwin) sha256=7fd17057d3e1f00e9954a74b3cd76595d3d4a5ef233b7ed9599047c204f70551
|
|
303
|
+
nokogiri (1.19.4-x86_64-linux-gnu) sha256=379fae440b28915e3f19d752ce2dcf8465ed2b2fbefd2a7ca0dd497bc981a06a
|
|
304
|
+
nokogiri (1.19.4-x86_64-linux-musl) sha256=17dfb7c1fa194ae02fbf7c51a7afc8d278045ab3fdacfd86f91d02d7b274470b
|
|
305
|
+
pp (0.6.4) sha256=dfcb0fce700c41456265922884f9fe195d7fbb0674a3578e6c0f69588e82b570
|
|
306
|
+
prettyprint (0.2.0) sha256=2bc9e15581a94742064a3cc8b0fb9d45aae3d03a1baa6ef80922627a0766f193
|
|
307
|
+
prism (1.9.0) sha256=7b530c6a9f92c24300014919c9dcbc055bf4cdf51ec30aed099b06cd6674ef85
|
|
308
|
+
puma (7.2.1) sha256=d7bf0e9cabd532e0d401e142cd94e3ac531e993610e2d80e6fbf9c26961414b0
|
|
309
|
+
racc (1.8.1) sha256=4a7f6929691dbec8b5209a0b373bc2614882b55fc5d2e447a21aaa691303d62f
|
|
310
|
+
rack (3.2.6) sha256=5ed78e1f73b2e25679bec7d45ee2d4483cc4146eb1be0264fc4d94cb5ef212c2
|
|
311
|
+
rack-session (2.1.2) sha256=595434f8c0c3473ae7d7ac56ecda6cc6dfd9d37c0b2b5255330aa1576967ffe8
|
|
312
|
+
rack-test (2.2.0) sha256=005a36692c306ac0b4a9350355ee080fd09ddef1148a5f8b2ac636c720f5c463
|
|
313
|
+
rackup (2.3.1) sha256=6c79c26753778e90983761d677a48937ee3192b3ffef6bc963c0950f94688868
|
|
314
|
+
rails (8.1.3) sha256=6d017ba5348c98fc909753a8169b21d44de14d2a0b92d140d1a966834c3c9cd3
|
|
315
|
+
rails-dom-testing (2.3.0) sha256=8acc7953a7b911ca44588bf08737bc16719f431a1cc3091a292bca7317925c1d
|
|
316
|
+
rails-html-sanitizer (1.7.0) sha256=28b145cceaf9cc214a9874feaa183c3acba036c9592b19886e0e45efc62b1e89
|
|
317
|
+
railties (8.1.3) sha256=913eb0e0cb520aac687ffd74916bd726d48fa21f47833c6292576ef6a286de22
|
|
318
|
+
rake (13.4.2) sha256=cb825b2bd5f1f8e91ca37bddb4b9aaf345551b4731da62949be002fa89283701
|
|
319
|
+
rbs (4.0.3) sha256=5a7bf70e2628549d9a1f44eae447b2cfe55968a9c60cfff52693a4bdcc020e14
|
|
320
|
+
rdoc (8.0.0) sha256=03bf8c08a9639658855a0cfd77c0abca8325c227693f7f33f82957811348c469
|
|
321
|
+
reline (0.6.3) sha256=1198b04973565b36ec0f11542ab3f5cfeeec34823f4e54cebde90968092b1835
|
|
322
|
+
securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
|
|
323
|
+
sqlite3 (2.9.5-aarch64-linux-gnu) sha256=78075b6337d3d182c6d2b4691049ed45cd220826160c9ea18946bf6a1de200dc
|
|
324
|
+
sqlite3 (2.9.5-aarch64-linux-musl) sha256=18c801185deb4adc01ddb281e8f672a39e3d1729979ca91e39439cd3eac0402d
|
|
325
|
+
sqlite3 (2.9.5-arm-linux-gnu) sha256=1bdfca0c7d63998c60b0f4a8e3c8df2d33800ccc4abd2d612eddbbbc92a4c48b
|
|
326
|
+
sqlite3 (2.9.5-arm-linux-musl) sha256=bae1109d12b2e9f588455967729b008e1ff4feb7761749df695019c9079913c6
|
|
327
|
+
sqlite3 (2.9.5-arm64-darwin) sha256=d0cf444a70fc9395d513cfbcc1e6719e224aa645314e3824cb0474c721425aa2
|
|
328
|
+
sqlite3 (2.9.5-x86_64-darwin) sha256=8e9caae38bd7ebb29cbeee3e7ab1d12dc2327d9a1b92c7fcf0dda05589627a81
|
|
329
|
+
sqlite3 (2.9.5-x86_64-linux-gnu) sha256=233dbcb6714148dd23bc5aeb33e8efd6eac974969564ddd5794c23d5f52b231e
|
|
330
|
+
sqlite3 (2.9.5-x86_64-linux-musl) sha256=e7d3a7474e8af0f96150c21abc203fbab5437206bfcdf11deab7741c0ca516f2
|
|
331
|
+
thor (1.5.0) sha256=e3a9e55fe857e44859ce104a84675ab6e8cd59c650a49106a05f55f136425e73
|
|
332
|
+
timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
|
|
333
|
+
tsort (0.2.0) sha256=9650a793f6859a43b6641671278f79cfead60ac714148aabe4e3f0060480089f
|
|
334
|
+
tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b
|
|
335
|
+
uri (1.1.1) sha256=379fa58d27ffb1387eaada68c749d1426738bd0f654d812fcc07e7568f5c57c6
|
|
336
|
+
us_geo (2.3.0)
|
|
337
|
+
useragent (0.16.11) sha256=700e6413ad4bb954bb63547fa098dddf7b0ebe75b40cc6f93b8d54255b173844
|
|
338
|
+
web-console (4.3.0) sha256=e13b71301cdfc2093f155b5aa3a622db80b4672d1f2f713119cc7ec7ac6a6da4
|
|
339
|
+
websocket-driver (0.8.2) sha256=97c556b019bf3410b4961002ac501621e9322d3f8a7bc02161a09301cc4c4146
|
|
340
|
+
websocket-extensions (0.1.5) sha256=1c6ba63092cda343eb53fc657110c71c754c56484aad42578495227d717a8241
|
|
341
|
+
zeitwerk (2.8.2) sha256=7212a61311083c604184b1ea2574b9aa05cd14f855a0841c06985cabe9181d12
|
|
342
|
+
|
|
343
|
+
BUNDLED WITH
|
|
344
|
+
4.0.3
|
|
@@ -24,6 +24,16 @@
|
|
|
24
24
|
<% end %>
|
|
25
25
|
</td>
|
|
26
26
|
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<th>USPS Locality</th>
|
|
29
|
+
<td>
|
|
30
|
+
<% if @zcta.usps_locality %>
|
|
31
|
+
<%= @zcta.usps_locality %>, <%= @zcta.usps_state_code %>
|
|
32
|
+
<% else %>
|
|
33
|
+
-
|
|
34
|
+
<% end %>
|
|
35
|
+
</td>
|
|
36
|
+
</tr>
|
|
27
37
|
<% if @zcta.combined_statistical_area %>
|
|
28
38
|
<tr>
|
|
29
39
|
<th>Combined Statistical Area</th>
|
|
@@ -14,6 +14,7 @@ namespace :us_geo do
|
|
|
14
14
|
urban_areas: USGeo::UrbanArea,
|
|
15
15
|
places: USGeo::Place,
|
|
16
16
|
zctas: USGeo::Zcta,
|
|
17
|
+
zcta_mappings: USGeo::ZctaMapping,
|
|
17
18
|
zcta_counties: USGeo::ZctaCounty,
|
|
18
19
|
zcta_urban_areas: USGeo::ZctaUrbanArea,
|
|
19
20
|
zcta_county_subdivisions: USGeo::ZctaCountySubdivision,
|
|
@@ -61,16 +62,13 @@ namespace :us_geo do
|
|
|
61
62
|
task dump_removed: :environment do
|
|
62
63
|
require "json"
|
|
63
64
|
|
|
64
|
-
|
|
65
|
+
data = {}
|
|
65
66
|
klasses.each_value do |klass|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
row_json JSON.dump(record.attributes.except("status", "updated_at"))
|
|
69
|
-
puts "#{row_json},"
|
|
67
|
+
data[klass.table_name] = klass.removed.collect do |record|
|
|
68
|
+
record.attributes.except("status", "updated_at")
|
|
70
69
|
end
|
|
71
|
-
puts "]"
|
|
72
70
|
end
|
|
73
|
-
puts
|
|
71
|
+
puts JSON.pretty_generate(data)
|
|
74
72
|
end
|
|
75
73
|
|
|
76
74
|
desc "Remove all records from previously imported data that no longer exists in the current data source"
|
data/lib/us_geo/area.rb
CHANGED
data/lib/us_geo/base_record.rb
CHANGED
|
@@ -15,6 +15,7 @@ module USGeo
|
|
|
15
15
|
|
|
16
16
|
validates :geoid, length: {is: 3}
|
|
17
17
|
validates :name, presence: true, length: {maximum: 60}, uniqueness: true
|
|
18
|
+
validates :short_name, presence: true, length: {maximum: 60}, uniqueness: true
|
|
18
19
|
validates :land_area, numericality: true, presence: true
|
|
19
20
|
validates :water_area, numericality: true, presence: true
|
|
20
21
|
validates :population, numericality: {only_integer: true}, presence: true
|
|
@@ -72,7 +72,11 @@ module USGeo
|
|
|
72
72
|
record.lng = row["Longitude"]
|
|
73
73
|
|
|
74
74
|
duplicate = where.not(geoid: record.geoid).find_by(name: record.name, county_geoid: record.county_geoid)
|
|
75
|
-
duplicate
|
|
75
|
+
if duplicate
|
|
76
|
+
suffix = " (deleted #{duplicate.geoid})"
|
|
77
|
+
deleted_name = "#{record.name[0, 60 - suffix.length]}#{suffix}"
|
|
78
|
+
duplicate.update!(name: deleted_name, status: BaseRecord::STATUS_REMOVED)
|
|
79
|
+
end
|
|
76
80
|
end
|
|
77
81
|
end
|
|
78
82
|
end
|
data/lib/us_geo/state.rb
CHANGED
|
@@ -36,10 +36,6 @@ module USGeo
|
|
|
36
36
|
# @!attribute type
|
|
37
37
|
# @return [String] Type of the state or territory.
|
|
38
38
|
|
|
39
|
-
# @!method :region
|
|
40
|
-
# @return [Region] Region the state is in.
|
|
41
|
-
delegate :region, to: :division, allow_nil: true
|
|
42
|
-
|
|
43
39
|
class << self
|
|
44
40
|
def load!(uri = nil)
|
|
45
41
|
location = data_uri(uri || "states.csv")
|
data/lib/us_geo/urban_area.rb
CHANGED
|
@@ -43,8 +43,8 @@ module USGeo
|
|
|
43
43
|
|
|
44
44
|
validates :geoid, length: {is: 5}
|
|
45
45
|
validates :primary_county_geoid, length: {is: 5}
|
|
46
|
-
validates :name, length: {maximum: 90}
|
|
47
|
-
validates :short_name, length: {maximum: 60}
|
|
46
|
+
validates :name, presence: true, length: {maximum: 90}
|
|
47
|
+
validates :short_name, presence: true, length: {maximum: 60}
|
|
48
48
|
validates :land_area, numericality: true, presence: true
|
|
49
49
|
validates :water_area, numericality: true, presence: true
|
|
50
50
|
validates :population, numericality: {only_integer: true}, presence: true
|
|
@@ -30,22 +30,22 @@ module USGeo
|
|
|
30
30
|
|
|
31
31
|
# Percentage of the urban area land area.
|
|
32
32
|
def percent_urban_area_land_area
|
|
33
|
-
land_area / urban_area.land_area
|
|
33
|
+
land_area / urban_area.land_area if urban_area.land_area.to_f > 0
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Percentage of the urban area total area.
|
|
37
37
|
def percent_urban_area_total_area
|
|
38
|
-
total_area / urban_area.total_area
|
|
38
|
+
total_area / urban_area.total_area if urban_area.total_area.to_f > 0
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Percentage of the county land area.
|
|
42
42
|
def percent_county_land_area
|
|
43
|
-
land_area / county.land_area
|
|
43
|
+
land_area / county.land_area if county.land_area.to_f > 0
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Percentage of the county total area.
|
|
47
47
|
def percent_county_total_area
|
|
48
|
-
total_area / county.total_area
|
|
48
|
+
total_area / county.total_area if county.total_area.to_f > 0
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -30,22 +30,22 @@ module USGeo
|
|
|
30
30
|
|
|
31
31
|
# Percentage of the urban area land area.
|
|
32
32
|
def percent_urban_area_land_area
|
|
33
|
-
land_area / urban_area.land_area
|
|
33
|
+
land_area / urban_area.land_area if urban_area.land_area.to_f > 0
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Percentage of the urban area total area.
|
|
37
37
|
def percent_urban_area_total_area
|
|
38
|
-
total_area / urban_area.total_area
|
|
38
|
+
total_area / urban_area.total_area if urban_area.total_area.to_f > 0
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
# Percentage of the county land area.
|
|
41
|
+
# Percentage of the county subdivision land area.
|
|
42
42
|
def percent_county_subdivision_land_area
|
|
43
|
-
land_area / county_subdivision.land_area
|
|
43
|
+
land_area / county_subdivision.land_area if county_subdivision.land_area.to_f > 0
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
# Percentage of the county total area.
|
|
46
|
+
# Percentage of the county subdivision total area.
|
|
47
47
|
def percent_county_subdivision_total_area
|
|
48
|
-
total_area / county_subdivision.total_area
|
|
48
|
+
total_area / county_subdivision.total_area if county_subdivision.total_area.to_f > 0
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
data/lib/us_geo/zcta.rb
CHANGED
|
@@ -11,6 +11,10 @@ module USGeo
|
|
|
11
11
|
#
|
|
12
12
|
# ZCTA's can span places, but the one with the majority of the residents is identified
|
|
13
13
|
# as the primary place for when a single area is required.
|
|
14
|
+
#
|
|
15
|
+
# The city and state that the U.S. Postal Service delivers mail to for the ZIP code are
|
|
16
|
+
# available as +usps_locality+ and +usps_state_code+. These are derived from postal data
|
|
17
|
+
# rather than census data and can differ from the primary place and state.
|
|
14
18
|
class Zcta < BaseRecord
|
|
15
19
|
include Population
|
|
16
20
|
include Area
|
|
@@ -82,10 +86,26 @@ module USGeo
|
|
|
82
86
|
validates :water_area, numericality: true, presence: true
|
|
83
87
|
validates :population, numericality: {only_integer: true}, presence: true
|
|
84
88
|
validates :housing_units, numericality: {only_integer: true}, presence: true
|
|
89
|
+
validates :usps_locality, length: {maximum: 30}, allow_nil: true
|
|
90
|
+
validates :usps_state_code, length: {is: 2}, allow_nil: true
|
|
85
91
|
|
|
86
92
|
# @!attribute zipcode
|
|
87
93
|
# @return [String] 5-digit ZIP code.
|
|
88
94
|
|
|
95
|
+
# @!attribute usps_locality
|
|
96
|
+
# The city the U.S. Postal Service associates with the ZIP code. This is the city
|
|
97
|
+
# that mail addressed to the ZIP code should be sent to and is not necessarily the
|
|
98
|
+
# same as the name of the primary place since the Postal Service organizes ZIP codes
|
|
99
|
+
# around mail delivery routes rather than political boundaries. It will be nil if the
|
|
100
|
+
# Postal Service does not deliver mail to the ZIP code.
|
|
101
|
+
# @return [String, nil] USPS city name for the ZIP code.
|
|
102
|
+
|
|
103
|
+
# @!attribute usps_state_code
|
|
104
|
+
# The state the U.S. Postal Service associates with the ZIP code. This can differ from
|
|
105
|
+
# the state of the primary county for ZIP codes served by a post office across a state
|
|
106
|
+
# line. It will be nil if the Postal Service does not deliver mail to the ZIP code.
|
|
107
|
+
# @return [String, nil] 2-letter USPS state code for the ZIP code.
|
|
108
|
+
|
|
89
109
|
# @!method combined_statistical_area
|
|
90
110
|
# @return [USGeo::CombinedStatisticalArea, nil] Combined statistical area that contains the ZCTA.
|
|
91
111
|
delegate :combined_statistical_area, to: :primary_county, allow_nil: true
|
|
@@ -124,6 +144,8 @@ module USGeo
|
|
|
124
144
|
record.primary_urban_area_geoid = row["Primary Urban Area"]
|
|
125
145
|
record.primary_county_subdivision_geoid = row["Primary County Subdivision"]
|
|
126
146
|
record.primary_place_geoid = row["Primary Place"]
|
|
147
|
+
record.usps_locality = row["USPS Locality"]
|
|
148
|
+
record.usps_state_code = row["USPS State Code"]
|
|
127
149
|
record.population = row["Population"]
|
|
128
150
|
record.housing_units = row["Housing Units"]
|
|
129
151
|
record.land_area = row["Land Area"]
|
data/lib/us_geo/zcta_county.rb
CHANGED
|
@@ -30,22 +30,22 @@ module USGeo
|
|
|
30
30
|
|
|
31
31
|
# Percentage of the ZCTA land area.
|
|
32
32
|
def percent_zcta_land_area
|
|
33
|
-
land_area / zcta.land_area
|
|
33
|
+
land_area / zcta.land_area if zcta.land_area.to_f > 0
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Percentage of the ZCTA total area.
|
|
37
37
|
def percent_zcta_total_area
|
|
38
|
-
total_area / zcta.total_area
|
|
38
|
+
total_area / zcta.total_area if zcta.total_area.to_f > 0
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Percentage of the county land area.
|
|
42
42
|
def percent_county_land_area
|
|
43
|
-
land_area / county.land_area
|
|
43
|
+
land_area / county.land_area if county.land_area.to_f > 0
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Percentage of the county total area.
|
|
47
47
|
def percent_county_total_area
|
|
48
|
-
total_area / county.total_area
|
|
48
|
+
total_area / county.total_area if county.total_area.to_f > 0
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
|
@@ -30,22 +30,22 @@ module USGeo
|
|
|
30
30
|
|
|
31
31
|
# Percentage of the ZCTA land area.
|
|
32
32
|
def percent_zcta_land_area
|
|
33
|
-
land_area / zcta.land_area
|
|
33
|
+
land_area / zcta.land_area if zcta.land_area.to_f > 0
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Percentage of the ZCTA total area.
|
|
37
37
|
def percent_zcta_total_area
|
|
38
|
-
total_area / zcta.total_area
|
|
38
|
+
total_area / zcta.total_area if zcta.total_area.to_f > 0
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Percentage of the county subdivision land area.
|
|
42
42
|
def percent_county_subdivision_land_area
|
|
43
|
-
land_area / county_subdivision.land_area
|
|
43
|
+
land_area / county_subdivision.land_area if county_subdivision.land_area.to_f > 0
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Percentage of the county subdivision total area.
|
|
47
47
|
def percent_county_subdivision_total_area
|
|
48
|
-
total_area / county_subdivision.total_area
|
|
48
|
+
total_area / county_subdivision.total_area if county_subdivision.total_area.to_f > 0
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
data/lib/us_geo/zcta_place.rb
CHANGED
|
@@ -28,34 +28,26 @@ module USGeo
|
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
# Percentage of the ZCTA population.
|
|
32
|
-
def percent_zcta_population
|
|
33
|
-
population.to_f / zcta.population.to_f
|
|
34
|
-
end
|
|
35
|
-
|
|
36
31
|
# Percentage of the ZCTA land area.
|
|
37
32
|
def percent_zcta_land_area
|
|
38
|
-
land_area / zcta.land_area
|
|
33
|
+
land_area / zcta.land_area if zcta.land_area.to_f > 0
|
|
39
34
|
end
|
|
40
35
|
|
|
41
36
|
# Percentage of the ZCTA total area.
|
|
42
37
|
def percent_zcta_total_area
|
|
43
|
-
total_area / zcta.total_area
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Percentage of the place population.
|
|
47
|
-
def percent_place_population
|
|
48
|
-
population.to_f / place.population.to_f
|
|
38
|
+
total_area / zcta.total_area if zcta.total_area.to_f > 0
|
|
49
39
|
end
|
|
50
40
|
|
|
51
|
-
# Percentage of the place land area.
|
|
41
|
+
# Percentage of the place land area. Returns nil if the place does not have
|
|
42
|
+
# a land area (i.e. places not included in the Census gazetteer data).
|
|
52
43
|
def percent_place_land_area
|
|
53
|
-
land_area / place.land_area
|
|
44
|
+
land_area / place.land_area if place.land_area.to_f > 0
|
|
54
45
|
end
|
|
55
46
|
|
|
56
|
-
# Percentage of the place total area
|
|
47
|
+
# Percentage of the place total area. Returns nil if the place does not have
|
|
48
|
+
# a land area (i.e. places not included in the Census gazetteer data).
|
|
57
49
|
def percent_place_total_area
|
|
58
|
-
total_area / place.total_area
|
|
50
|
+
total_area / place.total_area if place.total_area.to_f > 0
|
|
59
51
|
end
|
|
60
52
|
end
|
|
61
53
|
end
|
|
@@ -30,22 +30,22 @@ module USGeo
|
|
|
30
30
|
|
|
31
31
|
# Percentage of the ZCTA land area.
|
|
32
32
|
def percent_zcta_land_area
|
|
33
|
-
land_area / zcta.land_area
|
|
33
|
+
land_area / zcta.land_area if zcta.land_area.to_f > 0
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Percentage of the ZCTA total area.
|
|
37
37
|
def percent_zcta_total_area
|
|
38
|
-
total_area / zcta.total_area
|
|
38
|
+
total_area / zcta.total_area if zcta.total_area.to_f > 0
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Percentage of the urban area land area.
|
|
42
42
|
def percent_urban_area_land_area
|
|
43
|
-
land_area / urban_area.land_area
|
|
43
|
+
land_area / urban_area.land_area if urban_area.land_area.to_f > 0
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
# Percentage of the urban area total area.
|
|
47
47
|
def percent_urban_area_total_area
|
|
48
|
-
total_area / urban_area.total_area
|
|
48
|
+
total_area / urban_area.total_area if urban_area.total_area.to_f > 0
|
|
49
49
|
end
|
|
50
50
|
end
|
|
51
51
|
end
|
data/lib/us_geo.rb
CHANGED
|
@@ -35,7 +35,7 @@ module USGeo
|
|
|
35
35
|
autoload :ZctaPlace, "us_geo/zcta_place"
|
|
36
36
|
autoload :ZctaUrbanArea, "us_geo/zcta_urban_area"
|
|
37
37
|
|
|
38
|
-
BASE_DATA_URI = "https://raw.githubusercontent.com/bdurand/us_geo/
|
|
38
|
+
BASE_DATA_URI = "https://raw.githubusercontent.com/bdurand/us_geo/main/data/2020_dist"
|
|
39
39
|
|
|
40
40
|
class << self
|
|
41
41
|
# The root URI as a string of where to find the data files. This can be a URL
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: us_geo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Brian Durand
|
|
@@ -101,6 +101,7 @@ files:
|
|
|
101
101
|
- explorer_app/.gitattributes
|
|
102
102
|
- explorer_app/.gitignore
|
|
103
103
|
- explorer_app/Gemfile
|
|
104
|
+
- explorer_app/Gemfile.lock
|
|
104
105
|
- explorer_app/Rakefile
|
|
105
106
|
- explorer_app/app/assets/images/.keep
|
|
106
107
|
- explorer_app/app/assets/stylesheets/application.css
|