-
Notifications
You must be signed in to change notification settings - Fork 0
/
nbd_geocode.py
255 lines (238 loc) · 4.34 KB
/
nbd_geocode.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
from pygeocoder import Geocoder
import csv
def get_coordinates(location):
return Geocoder.geocode(location).coordinates
m_nbd = [
"Battery Park City",
"Bowery",
"Chinatown",
"Civic Center",
"East Village",
"Financial District",
"Greenwich Village",
"Little Italy",
"Lower East Side",
"NoHo",
"NoLita",
"SoHo",
"Tribeca",
"Two Bridges",
"West Village",
"Chelsea",
"Flatiron District",
"Garment District",
"Gramercy Park",
"Hell\'s Kitchen",
"Kips Bay",
"Koreatown",
"Midtown East",
"Murray Hill",
"NoMad",
"Stuyvesant Town - Peter Cooper Village",
"Theater District",
"Central Harlem",
"Central Park",
"East Harlem",
"Inwood",
"Upper East Side",
"Upper West Side",
"Washington Heights",
"West Harlem",
"Other",
"Randalls-Wards Island",
"Roosevelt Island"]
b_nbd = [
"Bedford-Stuyvesant",
"Bushwick",
"Greenpoint",
"Williamsburg",
"Boerum Hill",
"Carroll Gardens",
"Cobble Hill",
"Gowanus",
"Greenwood Heights",
"Park Slope",
"Prospect Park",
"Red Hook",
"Sunset Park",
"Windsor Terrace",
"Crown Heights",
"East Flatbush",
"Flatbush",
"Kensington",
"Midwood",
"Ocean Hill",
"Brooklyn Heights",
"Brooklyn Navy Yard",
"Clinton Hill",
"DUMBO",
"Downtown Brooklyn",
"Fort Greene",
"Prospect Heights",
"Vinegar Hill",
"Bath Beach",
"Bay Ridge",
"Bensonhurst",
"Borough Park",
"Dyker Heights",
"Mapleton",
"Southern Brooklyn",
"Brighton Beach",
"Coney Island",
"Gravesend",
"Sheepshead Bay",
"Brownsville",
"Canarsie",
"Cypress Hills",
"East New York",
"Bergen Beach",
"Flatlands",
"Floyd Bennett Airfield",
"Marine Park",
"Mill Basin"]
q_nbd = [
"Astoria",
"Corona",
"East Elmhurst",
"Elmhurst",
"Forest Hills",
"Glendale",
"Jackson Heights",
"Long Island City",
"Maspeth",
"Middle Village",
"Rego Park",
"Ridgewood",
"Sunnyside",
"Woodside",
"Auburndale",
"Bayside",
"College Point",
"Flushing",
"Flushing Meadows-Corona Park",
"Fresh Meadows",
"Glen Oaks",
"Kew Gardens",
"Kew Gardens Hills",
"Whitestone",
"Briarwood",
"Hollis",
"Holliswood",
"Jamaica",
"Jamaica Estates",
"Jamaica Hills",
"South Jamaica",
"St. Albans",
"Forest Park",
"Howard Beach",
"Ozone Park",
"Richmond Hill",
"South Ozone Park",
"Woodhaven",
"Far Rockaway",
"Rockaway Beach"]
bx_nbd = [
"Bedford Park",
"Belmont",
"Bronx Park",
"Concourse",
"Concourse Village",
"East Tremont",
"Fordham Heights",
"Fordham Manor",
"Highbridge",
"Hunts Point",
"Kingsbridge",
"Longwood",
"Marble Hill",
"Morris Heights",
"Morrisania",
"Mott Haven",
"Mount Eden",
"Mount Hope",
"Norwood",
"Riverdale",
"University Heights",
"Van Cortlandt Park",
"West Farms",
"Allerton",
"Clason Point",
"Morris Park",
"Parkchester",
"Pelham Bay",
"Pelham Parkway",
"Throgs Neck",
"Unionport",
"Van Nest",
"Wakefield",
"Westchester Village",
"Williamsbridge",
"Woodlawn Heights"]
j_nbd = [
"Bergen - Lafayette",
"Greenville",
"Historic Downtown",
"McGinley Square",
"The Heights",
"The Waterfront",
"West Side"]
s_nbd = [
"East Shore",
"Mid-Island",
"North Shore",
"South Shore",
]
college_nbd = [
"Baruch College (CUNY)",
"Columbia University",
"Cooper Union ",
"Fashion Institute of Technology (FIT) ",
"Hunter College ",
"John Jay College of Criminal Justice ",
"Juilliard School ",
"New York University (NYU) ",
"NYU Tandon School of Engineering ",
"Pace University ",
"Pratt Institute ",
"The New School ",
"Weill Cornell Medical College"
]
if __name__ == '__main__':
with open("coded_locs.csv", "w") as f:
writer = csv.writer(f, delimiter = ",")
# writer.writerow(["nbd", "lat", "lon"])
for i in m_nbd:
coords = get_coordinates(i + ", manhattan")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])
for i in b_nbd:
coords = get_coordinates(i + ", brooklyn")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])
for i in q_nbd:
coords = get_coordinates(i + ", queens")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])
for i in bx_nbd:
coords = get_coordinates(i + ", bronx")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])
for i in j_nbd:
coords = get_coordinates(i + ", new jersey")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])
for i in s_nbd:
coords = get_coordinates(i + ", staten island")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])
for i in college_nbd:
coords = get_coordinates(i + ", new york")
lat, lon = coords
print i, lat, lon
writer.writerow([i, lat, lon])