Skip to content

Instantly share code, notes, and snippets.

@JedIV
Last active August 29, 2015 13:56
Show Gist options
  • Save JedIV/8909433 to your computer and use it in GitHub Desktop.
Save JedIV/8909433 to your computer and use it in GitHub Desktop.
US Population Viewer
year rank city pop latitude longitude
0 1790 1 Philadelphia 44.1 39.952335 -75.16378900000001
1 1790 2 New York 33.1 40.7143528 -74.00597309999999
2 1790 3 Boston 18.3 42.3584308 -71.0597732
3 1790 4 Charleston 16.4 32.7765656 -79.93092159999999
4 1790 5 Salem, MA 13.6 42.51954 -70.8967155
5 1790 6 Baltimore 13.5 39.2903848 -76.6121893
6 1790 7 Newport, RI 6.7 41.4901024 -71.3128285
7 1790 8 Providence 6.4 41.8239891 -71.4128343
8 1790 9 Gloucester, MA 5.3 42.6159285 -70.6619888
9 1790 10 Newburyport, MA 4.8 42.8125913 -70.87727509999999
10 1790 11 Portsmouth, NH 4.7 43.0717552 -70.7625532
11 1790 12 Nantucket 4.6 41.2834704 -70.099451
12 1790 13 Middleborough, MA 4.5 41.8929942 -70.9107708
13 1790 14 New Haven 4.5 41.308274 -72.9278835
14 1790 15 Richmond 3.8 37.5407246 -77.4360481
15 1790 16 Albany 3.5 42.6525793 -73.7562317
16 1790 17 Norfolk 3.0 36.8507689 -76.28587259999999
17 1790 18 Petersburg, VA 2.8 37.2279279 -77.40192669999999
18 1790 19 Alexandria, VA 2.8 38.8048355 -77.0469214
19 1790 20 Hartford 2.7 41.76371109999999 -72.6850932
20 1800 1 Philadelphia 61.6 39.952335 -75.16378900000001
21 1800 2 New York 60.5 40.7143528 -74.00597309999999
22 1800 3 Baltimore 26.5 39.2903848 -76.6121893
23 1800 4 Boston 24.9 42.3584308 -71.0597732
24 1800 5 Charleston 18.8 32.7765656 -79.93092159999999
25 1800 6 Salem, MA 14.7 42.51954 -70.8967155
26 1800 7 Washington 11.2 38.90723089999999 -77.0364641
27 1800 8 Providence 7.6 41.8239891 -71.4128343
28 1800 9 Norfolk 6.9 36.8507689 -76.28587259999999
29 1800 10 Newport, RI 6.7 41.4901024 -71.3128285
30 1800 11 Newburyport, MA 6.0 42.8125913 -70.87727509999999
31 1800 12 Richmond 5.7 37.5407246 -77.4360481
32 1800 13 Nantucket 5.6 41.2834704 -70.099451
33 1800 14 Portsmouth, NH 5.3 43.0717552 -70.7625532
34 1800 15 Gloucester, MA 5.3 42.6159285 -70.6619888
35 1800 16 Schenectady, NY 5.3 42.8142432 -73.9395687
36 1800 17 Albany 5.3 42.6525793 -73.7562317
37 1800 18 New London, CT 5.2 41.3556539 -72.0995209
38 1800 19 Savannah 5.2 32.0835407 -81.09983419999999
39 1800 20 Middleborough, MA 4.5 41.8929942 -70.9107708
40 1810 1 New York 101.0 40.7143528 -74.00597309999999
41 1810 2 Philadelphia 87.3 39.952335 -75.16378900000001
42 1810 3 Baltimore 46.6 39.2903848 -76.6121893
43 1810 4 Boston 38.7 42.3584308 -71.0597732
44 1810 5 Charleston 24.7 32.7765656 -79.93092159999999
45 1810 6 Salem, MA 23.1 42.51954 -70.8967155
46 1810 7 Washington 20.4 38.90723089999999 -77.0364641
47 1810 8 New Orleans 17.2 29.95106579999999 -90.0715323
48 1810 9 Albany 10.8 42.6525793 -73.7562317
49 1810 10 Providence 10.1 41.8239891 -71.4128343
50 1810 11 Richmond 9.7 37.5407246 -77.4360481
51 1810 12 Norfolk 9.2 36.8507689 -76.28587259999999
52 1810 13 Newport, RI 7.9 41.4901024 -71.3128285
53 1810 14 Newburyport, MA 7.6 42.8125913 -70.87727509999999
54 1810 15 Portland, ME 7.2 43.66147100000001 -70.2553259
55 1810 16 Portsmouth, NH 6.9 43.0717552 -70.7625532
56 1810 17 Nantucket 6.8 41.2834704 -70.099451
57 1810 18 Gloucester, MA 5.9 42.6159285 -70.6619888
58 1810 19 Schenectady, NY 5.9 42.8142432 -73.9395687
59 1810 20 New Haven 5.8 41.308274 -72.9278835
60 1820 1 New York 131.0 40.7143528 -74.00597309999999
61 1820 2 Philadelphia 109.0 39.952335 -75.16378900000001
62 1820 3 Baltimore 62.7 39.2903848 -76.6121893
63 1820 4 Boston 54.0 42.3584308 -71.0597732
64 1820 5 Washington 28.8 38.90723089999999 -77.0364641
65 1820 6 New Orleans 27.2 29.95106579999999 -90.0715323
66 1820 7 Charleston 24.8 32.7765656 -79.93092159999999
67 1820 8 Salem, MA 22.6 42.51954 -70.8967155
68 1820 9 Albany 17.9 42.6525793 -73.7562317
69 1820 10 Richmond 12.1 37.5407246 -77.4360481
70 1820 11 Providence 11.8 41.8239891 -71.4128343
71 1820 12 Cincinnati 9.6 39.1031182 -84.5120196
72 1820 13 Portland, ME 8.6 43.66147100000001 -70.2553259
73 1820 14 Norfolk 8.5 36.8507689 -76.28587259999999
74 1820 15 Savannah 7.5 32.0835407 -81.09983419999999
75 1820 16 Portsmouth, NH 7.3 43.0717552 -70.7625532
76 1820 17 Newport, RI 7.3 41.4901024 -71.3128285
77 1820 18 Nantucket 7.3 41.2834704 -70.099451
78 1820 19 Pittsburgh 7.3 40.44062479999999 -79.9958864
79 1820 20 New Haven 7.2 41.308274 -72.9278835
80 1830 1 New York 215.0 40.7143528 -74.00597309999999
81 1830 2 Philadelphia 161.0 39.952335 -75.16378900000001
82 1830 3 Boston 85.6 42.3584308 -71.0597732
83 1830 4 Baltimore 80.6 39.2903848 -76.6121893
84 1830 5 New Orleans 46.1 29.95106579999999 -90.0715323
85 1830 6 Albany 35.8 42.6525793 -73.7562317
86 1830 7 Washington 35.5 38.90723089999999 -77.0364641
87 1830 8 Charleston 30.3 32.7765656 -79.93092159999999
88 1830 9 Salem, MA 27.3 42.51954 -70.8967155
89 1830 10 Cincinnati 24.8 39.1031182 -84.5120196
90 1830 11 Providence 22.4 41.8239891 -71.4128343
91 1830 12 Richmond 16.1 37.5407246 -77.4360481
92 1830 13 Pittsburgh 15.4 40.44062479999999 -79.9958864
93 1830 14 Newark 14.4 40.735657 -74.1723667
94 1830 15 Portland, ME 12.6 43.66147100000001 -70.2553259
95 1830 16 Louisville 10.3 38.2526647 -85.7584557
96 1830 17 New Haven 10.2 41.308274 -72.9278835
97 1830 18 Norfolk 9.8 36.8507689 -76.28587259999999
98 1830 19 Rochester 9.2 43.16103 -77.6109219
99 1830 20 Buffalo 8.7 42.88644679999999 -78.8783689
100 1840 1 New York 374.0 40.7143528 -74.00597309999999
101 1840 2 Philadelphia 259.0 39.952335 -75.16378900000001
102 1840 3 Boston 183.0 42.3584308 -71.0597732
103 1840 4 Baltimore 110.0 39.2903848 -76.6121893
104 1840 5 New Orleans 105.0 29.95106579999999 -90.0715323
105 1840 6 Albany 72.0 42.6525793 -73.7562317
106 1840 7 Cincinnati 54.8 39.1031182 -84.5120196
107 1840 8 Washington 50.2 38.90723089999999 -77.0364641
108 1840 9 Pittsburgh 43.7 40.44062479999999 -79.9958864
109 1840 10 Charleston 42.6 32.7765656 -79.93092159999999
110 1840 11 Providence 40.9 41.8239891 -71.4128343
111 1840 12 Louisville 34.2 38.2526647 -85.7584557
112 1840 13 Rochester 31.4 43.16103 -77.6109219
113 1840 14 Newark 29.8 40.735657 -74.1723667
114 1840 15 Buffalo 29.3 42.88644679999999 -78.8783689
115 1840 16 Portland, ME 28.6 43.66147100000001 -70.2553259
116 1840 17 St. Louis 28.4 38.6270025 -90.19940419999999
117 1840 18 New Bedford 24.1 41.6362152 -70.93420499999999
118 1840 19 New Haven 21.9 41.308274 -72.9278835
119 1840 20 Detroit 21.2 42.331427 -83.0457538
120 1850 1 New York 650.0 40.7143528 -74.00597309999999
121 1850 2 Philadelphia 405.0 39.952335 -75.16378900000001
122 1850 3 Boston 308.0 42.3584308 -71.0597732
123 1850 4 Baltimore 179.0 39.2903848 -76.6121893
124 1850 5 Cincinnati 133.0 39.1031182 -84.5120196
125 1850 6 New Orleans 123.0 29.95106579999999 -90.0715323
126 1850 7 Albany 107.0 42.6525793 -73.7562317
127 1850 8 St. Louis 95.0 38.6270025 -90.19940419999999
128 1850 9 Pittsburgh 86.0 40.44062479999999 -79.9958864
129 1850 10 Buffalo 80.0 42.88644679999999 -78.8783689
130 1850 11 Washington 67.0 38.90723089999999 -77.0364641
131 1850 12 Providence 65.0 41.8239891 -71.4128343
132 1850 13 Louisville 61.0 38.2526647 -85.7584557
133 1850 14 Newark 57.0 40.735657 -74.1723667
134 1850 15 Charleston 50.0 32.7765656 -79.93092159999999
135 1850 16 Rochester 49.0 43.16103 -77.6109219
136 1850 17 Chicago 40.0 41.8781136 -87.6297982
137 1850 18 Syracuse 38.0 43.0481221 -76.14742439999999
138 1850 19 Detroit 38.0 42.331427 -83.0457538
139 1850 20 Portland, ME 36.0 43.66147100000001 -70.2553259
140 1860 1 New York 1143.0 40.7143528 -74.00597309999999
141 1860 2 Philadelphia 608.0 39.952335 -75.16378900000001
142 1860 3 Boston 374.0 42.3584308 -71.0597732
143 1860 4 Baltimore 221.0 39.2903848 -76.6121893
144 1860 5 Cincinnati 192.0 39.1031182 -84.5120196
145 1860 6 St. Louis 176.0 38.6270025 -90.19940419999999
146 1860 7 New Orleans 172.0 29.95106579999999 -90.0715323
147 1860 8 Chicago 123.0 41.8781136 -87.6297982
148 1860 9 Albany 116.0 42.6525793 -73.7562317
149 1860 10 Newark 103.0 40.735657 -74.1723667
150 1860 11 Pittsburgh 93.0 40.44062479999999 -79.9958864
151 1860 12 Buffalo 90.0 42.88644679999999 -78.8783689
152 1860 13 Louisville 88.0 38.2526647 -85.7584557
153 1860 14 Washington 80.0 38.90723089999999 -77.0364641
154 1860 15 Providence 69.0 41.8239891 -71.4128343
155 1860 16 Detroit 59.0 42.331427 -83.0457538
156 1860 17 San Francisco 57.0 37.7749295 -122.4194155
157 1860 18 Rochester 56.0 43.16103 -77.6109219
158 1860 19 Cleveland 49.0 41.4994954 -81.6954088
159 1860 20 Milwaukee 48.0 43.0389025 -87.9064736
160 1870 1 New York 1687.0 40.7143528 -74.00597309999999
161 1870 2 Philadelphia 747.0 39.952335 -75.16378900000001
162 1870 3 Boston 501.0 42.3584308 -71.0597732
163 1870 4 St. Louis 345.0 38.6270025 -90.19940419999999
164 1870 5 Chicago 324.0 41.8781136 -87.6297982
165 1870 6 Baltimore 283.0 39.2903848 -76.6121893
166 1870 7 Cincinnati 257.0 39.1031182 -84.5120196
167 1870 8 New Orleans 196.0 29.95106579999999 -90.0715323
168 1870 9 Pittsburgh 170.0 40.44062479999999 -79.9958864
169 1870 10 Albany 157.0 42.6525793 -73.7562317
170 1870 11 San Francisco 151.0 37.7749295 -122.4194155
171 1870 12 Buffalo 133.0 42.88644679999999 -78.8783689
172 1870 13 Louisville 129.0 38.2526647 -85.7584557
173 1870 14 Washington 123.0 38.90723089999999 -77.0364641
174 1870 15 Providence 101.0 41.8239891 -71.4128343
175 1870 16 Detroit 101.0 42.331427 -83.0457538
176 1870 17 Cleveland 101.0 41.4994954 -81.6954088
177 1870 18 Milwaukee 75.0 43.0389025 -87.9064736
178 1870 19 Rochester 73.0 43.16103 -77.6109219
179 1870 20 New Haven 65.0 41.308274 -72.9278835
180 1880 1 New York 2234.0 40.7143528 -74.00597309999999
181 1880 2 Philadelphia 949.0 39.952335 -75.16378900000001
182 1880 3 Boston 658.0 42.3584308 -71.0597732
183 1880 4 Chicago 543.0 41.8781136 -87.6297982
184 1880 5 St. Louis 386.0 38.6270025 -90.19940419999999
185 1880 6 Baltimore 353.0 39.2903848 -76.6121893
186 1880 7 Cincinnati 307.0 39.1031182 -84.5120196
187 1880 8 Pittsburgh 265.0 40.44062479999999 -79.9958864
188 1880 9 San Francisco 236.0 37.7749295 -122.4194155
189 1880 10 New Orleans 219.0 29.95106579999999 -90.0715323
190 1880 11 Albany 178.0 42.6525793 -73.7562317
191 1880 12 Buffalo 171.0 42.88644679999999 -78.8783689
192 1880 13 Cleveland 169.0 41.4994954 -81.6954088
193 1880 14 Washington 164.0 38.90723089999999 -77.0364641
194 1880 15 Detroit 147.0 42.331427 -83.0457538
195 1880 16 Louisville 143.0 38.2526647 -85.7584557
196 1880 17 Providence 128.0 41.8239891 -71.4128343
197 1880 18 Milwaukee 121.0 43.0389025 -87.9064736
198 1880 19 Rochester 103.0 43.16103 -77.6109219
199 1880 20 Minneapolis 94.0 44.983334 -93.26666999999999
200 1890 1 New York 2977.0 40.7143528 -74.00597309999999
201 1890 2 Philadelphia 1180.0 39.952335 -75.16378900000001
202 1890 3 Chicago 1141.0 41.8781136 -87.6297982
203 1890 4 Boston 818.0 42.3584308 -71.0597732
204 1890 5 St. Louis 490.0 38.6270025 -90.19940419999999
205 1890 6 Baltimore 453.0 39.2903848 -76.6121893
206 1890 7 Pittsburgh 396.0 40.44062479999999 -79.9958864
207 1890 8 Cincinnati 344.0 39.1031182 -84.5120196
208 1890 9 Minneapolis 305.0 44.983334 -93.26666999999999
209 1890 10 San Francisco 302.0 37.7749295 -122.4194155
210 1890 11 Cleveland 274.0 41.4994954 -81.6954088
211 1890 12 Buffalo 272.0 42.88644679999999 -78.8783689
212 1890 13 Washington 253.0 38.90723089999999 -77.0364641
213 1890 14 New Orleans 245.0 29.95106579999999 -90.0715323
214 1890 15 Detroit 237.0 42.331427 -83.0457538
215 1890 16 Milwaukee 212.0 43.0389025 -87.9064736
216 1890 17 Albany 189.0 42.6525793 -73.7562317
217 1890 18 Louisville 183.0 38.2526647 -85.7584557
218 1890 19 Kansas City 165.0 39.0997265 -94.5785667
219 1890 20 Providence 163.0 41.8239891 -71.4128343
220 1900 1 New York 4266.0 40.7143528 -74.00597309999999
221 1900 2 Chicago 1759.0 41.8781136 -87.6297982
222 1900 3 Philadelphia 1454.0 39.952335 -75.16378900000001
223 1900 4 Boston 1009.0 42.3584308 -71.0597732
224 1900 5 St. Louis 626.0 38.6270025 -90.19940419999999
225 1900 6 Pittsburgh 532.0 40.44062479999999 -79.9958864
226 1900 7 Baltimore 532.0 39.2903848 -76.6121893
227 1900 8 Cleveland 396.0 41.4994954 -81.6954088
228 1900 9 Cincinnati 379.0 39.1031182 -84.5120196
229 1900 10 San Francisco 375.0 37.7749295 -122.4194155
230 1900 11 Minneapolis 374.0 44.983334 -93.26666999999999
231 1900 12 Buffalo 373.0 42.88644679999999 -78.8783689
232 1900 13 Detroit 321.0 42.331427 -83.0457538
233 1900 14 Washington 302.0 38.90723089999999 -77.0364641
234 1900 15 Milwaukee 296.0 43.0389025 -87.9064736
235 1900 16 New Orleans 291.0 29.95106579999999 -90.0715323
236 1900 17 Providence 243.0 41.8239891 -71.4128343
237 1900 18 Kansas City 242.0 39.0997265 -94.5785667
238 1900 19 Louisville 227.0 38.2526647 -85.7584557
239 1900 20 Albany 188.0 42.6525793 -73.7562317
240 1910 1 New York 6021.0 40.7143528 -74.00597309999999
241 1910 2 Chicago 2283.0 41.8781136 -87.6297982
242 1910 3 Philadelphia 1746.0 39.952335 -75.16378900000001
243 1910 4 Boston 1213.0 42.3584308 -71.0597732
244 1910 5 St. Louis 760.0 38.6270025 -90.19940419999999
245 1910 6 Pittsburgh 655.0 40.44062479999999 -79.9958864
246 1910 7 San Francisco 604.0 37.7749295 -122.4194155
247 1910 8 Baltimore 589.0 39.2903848 -76.6121893
248 1910 9 Cleveland 580.0 41.4994954 -81.6954088
249 1910 10 Minneapolis 526.0 44.983334 -93.26666999999999
250 1910 11 Detroit 503.0 42.331427 -83.0457538
251 1910 12 Cincinnati 425.0 39.1031182 -84.5120196
252 1910 13 Buffalo 420.0 42.88644679999999 -78.8783689
253 1910 14 Milwaukee 389.0 43.0389025 -87.9064736
254 1910 15 Los Angeles 374.0 34.0522342 -118.2436849
255 1910 16 Kansas City 357.0 39.0997265 -94.5785667
256 1910 17 Washington 357.0 38.90723089999999 -77.0364641
257 1910 18 New Orleans 344.0 29.95106579999999 -90.0715323
258 1910 19 Albany 283.0 42.6525793 -73.7562317
259 1910 20 Providence 274.0 41.8239891 -71.4128343
260 1920 1 New York 7041.0 40.7143528 -74.00597309999999
261 1920 2 Chicago 2859.0 41.8781136 -87.6297982
262 1920 3 Philadelphia 2072.0 39.952335 -75.16378900000001
263 1920 4 Boston 1366.0 42.3584308 -71.0597732
264 1920 5 Detroit 1071.0 42.331427 -83.0457538
265 1920 6 St. Louis 859.0 38.6270025 -90.19940419999999
266 1920 7 Cleveland 834.0 41.4994954 -81.6954088
267 1920 8 Pittsburgh 775.0 40.44062479999999 -79.9958864
268 1920 9 San Francisco 771.0 37.7749295 -122.4194155
269 1920 10 Baltimore 753.0 39.2903848 -76.6121893
270 1920 11 Los Angeles 682.0 34.0522342 -118.2436849
271 1920 12 Minneapolis 626.0 44.983334 -93.26666999999999
272 1920 13 Buffalo 539.0 42.88644679999999 -78.8783689
273 1920 14 Milwaukee 478.0 43.0389025 -87.9064736
274 1920 15 Cincinnati 470.0 39.1031182 -84.5120196
275 1920 16 Washington 467.0 38.90723089999999 -77.0364641
276 1920 17 Kansas City 455.0 39.0997265 -94.5785667
277 1920 18 New Orleans 393.0 29.95106579999999 -90.0715323
278 1920 19 Seattle 334.0 47.6062095 -122.3320708
279 1920 20 Indianapolis 323.0 39.768403 -86.158068
280 1930 1 New York 8667.0 40.7143528 -74.00597309999999
281 1930 2 Chicago 3718.0 41.8781136 -87.6297982
282 1930 3 Philadelphia 2264.0 39.952335 -75.16378900000001
283 1930 4 Detroit 1721.0 42.331427 -83.0457538
284 1930 5 Los Angeles 1617.0 34.0522342 -118.2436849
285 1930 6 Boston 1479.0 42.3584308 -71.0597732
286 1930 7 San Francisco 996.0 37.7749295 -122.4194155
287 1930 8 Cleveland 976.0 41.4994954 -81.6954088
288 1930 9 Pittsburgh 960.0 40.44062479999999 -79.9958864
289 1930 10 St. Louis 950.0 38.6270025 -90.19940419999999
290 1930 11 Baltimore 836.0 39.2903848 -76.6121893
291 1930 12 Minneapolis 753.0 44.983334 -93.26666999999999
292 1930 13 Buffalo 620.0 42.88644679999999 -78.8783689
293 1930 14 Milwaukee 615.0 43.0389025 -87.9064736
294 1930 15 Cincinnati 580.0 39.1031182 -84.5120196
295 1930 16 Kansas City 561.0 39.0997265 -94.5785667
296 1930 17 Washington 527.0 38.90723089999999 -77.0364641
297 1930 18 New Orleans 469.0 29.95106579999999 -90.0715323
298 1930 19 Seattle 390.0 47.6062095 -122.3320708
299 1930 20 Indianapolis 379.0 39.768403 -86.158068
300 1940 1 New York 10135.0 40.7143528 -74.00597309999999
301 1940 2 Chicago 4210.0 41.8781136 -87.6297982
302 1940 3 Philadelphia 2538.0 39.952335 -75.16378900000001
303 1940 4 Los Angeles 2268.0 34.0522342 -118.2436849
304 1940 5 Detroit 2041.0 42.331427 -83.0457538
305 1940 6 Boston 1746.0 42.3584308 -71.0597732
306 1940 7 San Francisco 1156.0 37.7749295 -122.4194155
307 1940 8 Pittsburgh 1134.0 40.44062479999999 -79.9958864
308 1940 9 St. Louis 1102.0 38.6270025 -90.19940419999999
309 1940 10 Cleveland 1079.0 41.4994954 -81.6954088
310 1940 11 Baltimore 992.0 39.2903848 -76.6121893
311 1940 12 Minneapolis 886.0 44.983334 -93.26666999999999
312 1940 13 Washington 800.0 38.90723089999999 -77.0364641
313 1940 14 Buffalo 708.0 42.88644679999999 -78.8783689
314 1940 15 Milwaukee 705.0 43.0389025 -87.9064736
315 1940 16 Kansas City 632.0 39.0997265 -94.5785667
316 1940 17 Cincinnati 559.0 39.1031182 -84.5120196
317 1940 18 New Orleans 557.0 29.95106579999999 -90.0715323
318 1940 19 Houston 471.0 29.7601927 -95.36938959999999
319 1940 20 Seattle 451.0 47.6062095 -122.3320708
320 1950 1 New York 12604.0 40.7143528 -74.00597309999999
321 1950 2 Chicago 5208.0 41.8781136 -87.6297982
322 1950 3 Los Angeles 4250.0 34.0522342 -118.2436849
323 1950 4 Philadelphia 3297.0 39.952335 -75.16378900000001
324 1950 5 Detroit 2884.0 42.331427 -83.0457538
325 1950 6 Boston 2301.0 42.3584308 -71.0597732
326 1950 7 San Francisco 2131.0 37.7749295 -122.4194155
327 1950 8 St. Louis 1541.0 38.6270025 -90.19940419999999
328 1950 9 Cleveland 1425.0 41.4994954 -81.6954088
329 1950 10 Pittsburgh 1400.0 40.44062479999999 -79.9958864
330 1950 11 Washington 1287.0 38.90723089999999 -77.0364641
331 1950 12 Baltimore 1162.0 39.2903848 -76.6121893
332 1950 13 Minneapolis 987.0 44.983334 -93.26666999999999
333 1950 14 Buffalo 895.0 42.88644679999999 -78.8783689
334 1950 15 Dallas 855.0 32.7801399 -96.80045109999999
335 1950 16 Milwaukee 829.0 43.0389025 -87.9064736
336 1950 17 Cincinnati 813.0 39.1031182 -84.5120196
337 1950 18 Houston 701.0 29.7601927 -95.36938959999999
338 1950 19 Kansas City 698.0 39.0997265 -94.5785667
339 1950 20 New Orleans 660.0 29.95106579999999 -90.0715323
340 1960 1 New York 14437.0 40.7143528 -74.00597309999999
341 1960 2 Los Angeles 6805.0 34.0522342 -118.2436849
342 1960 3 Chicago 6377.0 41.8781136 -87.6297982
343 1960 4 Philadelphia 3989.0 39.952335 -75.16378900000001
344 1960 5 Detroit 3750.0 42.331427 -83.0457538
345 1960 6 San Francisco 2607.0 37.7749295 -122.4194155
346 1960 7 Boston 2501.0 42.3584308 -71.0597732
347 1960 8 Pittsburgh 2105.0 40.44062479999999 -79.9958864
348 1960 9 Washington 1905.0 38.90723089999999 -77.0364641
349 1960 10 St. Louis 1864.0 38.6270025 -90.19940419999999
350 1960 11 Cleveland 1785.0 41.4994954 -81.6954088
351 1960 12 Dallas 1435.0 32.7801399 -96.80045109999999
352 1960 13 Baltimore 1419.0 39.2903848 -76.6121893
353 1960 14 Minneapolis 1377.0 44.983334 -93.26666999999999
354 1960 15 Miami 1173.0 25.7889689 -80.2264393
355 1960 16 Milwaukee 1150.0 43.0389025 -87.9064736
356 1960 17 Houston 1140.0 29.7601927 -95.36938959999999
357 1960 18 Buffalo 1054.0 42.88644679999999 -78.8783689
358 1960 19 Cincinnati 994.0 39.1031182 -84.5120196
359 1960 20 Kansas City 921.0 39.0997265 -94.5785667
360 1970 1 New York 16193.0 40.7143528 -74.00597309999999
361 1970 2 Los Angeles 7984.0 34.0522342 -118.2436849
362 1970 3 Chicago 7164.0 41.8781136 -87.6297982
363 1970 4 Philadelphia 4419.0 39.952335 -75.16378900000001
364 1970 5 Detroit 4085.0 42.331427 -83.0457538
365 1970 6 San Francisco 3049.0 37.7749295 -122.4194155
366 1970 7 Boston 2703.0 42.3584308 -71.0597732
367 1970 8 Washington 2671.0 38.90723089999999 -77.0364641
368 1970 9 Pittsburgh 2124.0 40.44062479999999 -79.9958864
369 1970 10 St. Louis 2123.0 38.6270025 -90.19940419999999
370 1970 11 Dallas 2016.0 32.7801399 -96.80045109999999
371 1970 12 Cleveland 1960.0 41.4994954 -81.6954088
372 1970 13 Miami 1834.0 25.7889689 -80.2264393
373 1970 14 Minneapolis 1701.0 44.983334 -93.26666999999999
374 1970 15 Houston 1678.0 29.7601927 -95.36938959999999
375 1970 16 Baltimore 1580.0 39.2903848 -76.6121893
376 1970 17 Milwaukee 1252.0 43.0389025 -87.9064736
377 1970 18 Seattle 1238.0 47.6062095 -122.3320708
378 1970 19 San Diego 1198.0 32.7153292 -117.1572551
379 1970 20 Atlanta 1172.0 33.7489954 -84.3879824
380 1980 1 New York 16500.0 40.7143528 -74.00597309999999
381 1980 2 Los Angeles 10841.0 34.0522342 -118.2436849
382 1980 3 Chicago 7325.0 41.8781136 -87.6297982
383 1980 4 Philadelphia 4830.0 39.952335 -75.16378900000001
384 1980 5 Detroit 4214.0 42.331427 -83.0457538
385 1980 6 San Francisco 4185.0 37.7749295 -122.4194155
386 1980 7 Boston 3064.0 42.3584308 -71.0597732
387 1980 8 Washington 2912.0 38.90723089999999 -77.0364641
388 1980 9 Houston 2757.0 29.7601927 -95.36938959999999
389 1980 10 Dallas 2713.0 32.7801399 -96.80045109999999
390 1980 11 Miami 2616.0 25.7889689 -80.2264393
391 1980 12 St. Louis 1849.0 38.6270025 -90.19940419999999
392 1980 13 Pittsburgh 1810.0 40.44062479999999 -79.9958864
393 1980 14 Minneapolis 1788.0 44.983334 -93.26666999999999
394 1980 15 Baltimore 1755.0 39.2903848 -76.6121893
395 1980 16 Cleveland 1752.0 41.4994954 -81.6954088
396 1980 17 San Diego 1704.0 32.7153292 -117.1572551
397 1980 18 Atlanta 1613.0 33.7489954 -84.3879824
398 1980 19 Phoenix 1409.0 33.4483771 -112.0740373
399 1980 20 Seattle 1392.0 47.6062095 -122.3320708
400 1990 1 New York 16754.0 40.7143528 -74.00597309999999
401 1990 2 Los Angeles 13522.0 34.0522342 -118.2436849
402 1990 3 Chicago 7373.0 41.8781136 -87.6297982
403 1990 4 San Francisco 5386.0 37.7749295 -122.4194155
404 1990 5 Philadelphia 4970.0 39.952335 -75.16378900000001
405 1990 6 Miami 3948.0 25.7889689 -80.2264393
406 1990 7 Detroit 3698.0 42.331427 -83.0457538
407 1990 8 Washington 3363.0 38.90723089999999 -77.0364641
408 1990 9 Boston 3355.0 42.3584308 -71.0597732
409 1990 10 Dallas 3265.0 32.7801399 -96.80045109999999
410 1990 11 Houston 3088.0 29.7601927 -95.36938959999999
411 1990 12 Seattle 2354.0 47.6062095 -122.3320708
412 1990 13 San Diego 2348.0 32.7153292 -117.1572551
413 1990 14 Atlanta 2158.0 33.7489954 -84.3879824
414 1990 15 Minneapolis 2080.0 44.983334 -93.26666999999999
415 1990 16 Phoenix 2006.0 33.4483771 -112.0740373
416 1990 17 St. Louis 1947.0 38.6270025 -90.19940419999999
417 1990 18 Baltimore 1890.0 39.2903848 -76.6121893
418 1990 19 Pittsburgh 1744.0 40.44062479999999 -79.9958864
419 1990 20 Tampa 1709.0 27.950575 -82.4571776
420 2000 1 New York 18689.0 40.7143528 -74.00597309999999
421 2000 2 Los Angeles 14661.0 34.0522342 -118.2436849
422 2000 3 Chicago 8419.0 41.8781136 -87.6297982
423 2000 4 San Francisco 5973.0 37.7749295 -122.4194155
424 2000 5 Philadelphia 5418.0 39.952335 -75.16378900000001
425 2000 6 Miami 4919.0 25.7889689 -80.2264393
426 2000 7 Dallas 4445.0 32.7801399 -96.80045109999999
427 2000 8 Houston 4063.0 29.7601927 -95.36938959999999
428 2000 9 Boston 4032.0 42.3584308 -71.0597732
429 2000 10 Washington 3934.0 38.90723089999999 -77.0364641
430 2000 11 Detroit 3903.0 42.331427 -83.0457538
431 2000 12 Atlanta 3500.0 33.7489954 -84.3879824
432 2000 13 Seattle 3018.0 47.6062095 -122.3320708
433 2000 14 Phoenix 2975.0 33.4483771 -112.0740373
434 2000 15 San Diego 2674.0 32.7153292 -117.1572551
435 2000 16 Minneapolis 2389.0 44.983334 -93.26666999999999
436 2000 17 Baltimore 2251.0 39.2903848 -76.6121893
437 2000 18 Denver 2231.0 39.737567 -104.9847179
438 2000 19 St. Louis 2078.0 38.6270025 -90.19940419999999
439 2000 20 Tampa 2062.0 27.950575 -82.4571776
440 2010 1 New York 20009.0 40.7143528 -74.00597309999999
441 2010 2 Los Angeles 15750.0 34.0522342 -118.2436849
442 2010 3 Chicago 9023.0 41.8781136 -87.6297982
443 2010 4 San Francisco 6828.0 37.7749295 -122.4194155
444 2010 5 Philadelphia 6003.0 39.952335 -75.16378900000001
445 2010 6 Dallas 5685.0 32.7801399 -96.80045109999999
446 2010 7 Miami 5513.0 25.7889689 -80.2264393
447 2010 8 Houston 5382.0 29.7601927 -95.36938959999999
448 2010 9 Atlanta 4743.0 33.7489954 -84.3879824
449 2010 10 Washington 4697.0 38.90723089999999 -77.0364641
450 2010 11 Boston 4407.0 42.3584308 -71.0597732
451 2010 12 Detroit 4160.0 42.331427 -83.0457538
452 2010 13 Phoenix 3863.0 33.4483771 -112.0740373
453 2010 14 Seattle 3446.0 47.6062095 -122.3320708
454 2010 15 San Diego 2985.0 32.7153292 -117.1572551
455 2010 16 Denver 2716.0 39.737567 -104.9847179
456 2010 17 Minneapolis 2651.0 44.983334 -93.26666999999999
457 2010 18 Baltimore 2497.0 39.2903848 -76.6121893
458 2010 19 Tampa 2442.0 27.950575 -82.4571776
459 2010 20 St. Louis 2246.0 38.6270025 -90.19940419999999
<!DOCTYPE html>
<meta charset="utf-8">
<style>
h1 {
font-size: 64px;
}
h1, h2, h3 {
font-weight: inherit;
margin: 0;
}
h2, h3 {
text-align: left;
font-size: inherit;
position: absolute;
<!-- bottom: 0; -->
right: 0;
}
h2 {
font-size: 14px;
position: absolute;
}
h3 {
font-size: 12px;
position: absolute;
bottom: 0;
}
.states {
fill: #ccc;
stroke: #fff;
}
.circle {
fill: steelblue;
stroke: grey;
opacity: .6;
}
.circle:hover {
fill: orangered;
}
.d3-tip {
line-height: 1;
font-weight: bold;
padding: 12px;
background: rgba(0, 0, 0, 0.8);
color: #fff;
border-radius: 2px;
position: absolute;
}
/* Style northward tooltips differently */
.d3-tip.n:after {
margin: -1px 0 0 0;
top: 100%;
left: 0;
}
</style>
<body>
<h1>
<span></span>
</h1>
<h2>
U.S. Largest Cities<br>
1790 - 2010<br>
Press any key.
<span></span>
</h2>
<h3>
Data scraped from: <a href = "http://www.peakbagger.com/pbgeog/histmetropop.aspx"> peakbagger.com </a>
</h3>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v1.min.js"></script>
<script src="http://labratrevenge.com/d3-tip/javascripts/d3.tip.v0.6.3.js"></script>
<script>
var width = 960,
height = 500;
var radius = d3.scale.sqrt()
.domain([0, 1e6])
.range([0, 10]);
//http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
var tip = d3.tip()
.attr('class', 'd3-tip')
.offset([-10, 0])
.html(function(d) {
return "<strong> <span style='color:red'>" + d.city + "</span>" +
"<strong><br>Rank:</strong> <span style='color:white'>" + d.rank + "</span>" +
"<strong><br>Pop:</strong> <span style='color:white'>" + numberWithCommas(d.pop * 1000) + "</span>";
})
var projection = d3.geo.conicConformal()
.rotate([98, 0])
.center([0, 38])
.parallels([29.5, 45.5])
.scale(1000)
.translate([width / 2, height / 2])
.precision(.1);
var path = d3.geo.path()
.projection(projection);
var pop_data = [];
var year = 1790;
function get_data(the_year){
d3.csv("citypop_with_lat_long.csv", function(error, data) {
pop_data = data.filter(function(d) { return d.year == the_year; })
});
};
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
svg.call(tip);
d3.json ("us.json", function(error, us) {
svg.append("path")
.attr("class", "states")
.datum(topojson.feature(us, us.objects.states))
.attr("d", path);
});
render(year);
function render(the_year){
svg.selectAll("circle").remove();
get_data(the_year);
var cities = svg.selectAll("circle")
.data(pop_data);
cities
.enter().append("circle")
.attr("class","circle")
.attr("cx", function(d) {
return projection([d.longitude, d.latitude])[0];
})
.attr("cy", function(d) {
return projection([d.longitude, d.latitude])[1];
})
.attr("r" , function(d) {return (Math.sqrt(d.pop)/3);
})
.on('mouseover', tip.show)
.on('mouseout', tip.hide);
d3.select("h1 span").text(year);
var columns = ["city", "rank"];
d3.select("table").remove();
var table = d3.select("h2 span").append("table"),
thead = table.append("thead"),
tbody = table.append("tbody");
// append the header row
thead.append("tr")
.selectAll("th")
.data(columns)
.enter()
.append("th")
.text(function(column) { return column; });
// create a row for each object in the data
var rows = tbody.selectAll("tr")
.data(pop_data)
.enter()
.append("tr");
// create a cell in each row for each column
var cells = rows.selectAll("td")
.data(function(row) {
return columns.map(function(column) {
return {column: column, value: row[column]};
});
})
.enter()
.append("td")
.text(function(d) { return d.value; });
};
d3.select("body")
.on("keydown", function(event) {
if (year < 2010)
{
new_year = year + 10;
render(new_year);
}
else
{
new_year = 1790;
render(new_year);
}
year = new_year;
return false;
});
</script>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment