-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgeo.py
66 lines (63 loc) · 1.23 KB
/
geo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
"""Geo location constants for constructing Safegraph indicator."""
# https://code.activestate.com/recipes/577775-state-fips-codes-dict/
STATE_TO_FIPS = {
"AS": "60", # American Samoa
"GU": "66", # Guam
"MP": "69", # Northern Mariana Islands
"VI": "78", # Virgin Islands
"WA": "53",
"DE": "10",
"DC": "11",
"WI": "55",
"WV": "54",
"HI": "15",
"FL": "12",
"WY": "56",
"PR": "72",
"NJ": "34",
"NM": "35",
"TX": "48",
"LA": "22",
"NC": "37",
"ND": "38",
"NE": "31",
"TN": "47",
"NY": "36",
"PA": "42",
"AK": "02",
"NV": "32",
"NH": "33",
"VA": "51",
"CO": "08",
"CA": "06",
"AL": "01",
"AR": "05",
"VT": "50",
"IL": "17",
"GA": "13",
"IN": "18",
"IA": "19",
"MA": "25",
"AZ": "04",
"ID": "16",
"CT": "09",
"ME": "23",
"MD": "24",
"OK": "40",
"OH": "39",
"UT": "49",
"MO": "29",
"MN": "27",
"MI": "26",
"RI": "44",
"KS": "20",
"MT": "30",
"MS": "28",
"SC": "45",
"KY": "21",
"OR": "41",
"SD": "46",
}
FIPS_TO_STATE = {v: k.lower() for k, v in STATE_TO_FIPS.items()}
VALID_GEO_RESOLUTIONS = ('county', 'state')