Skip to content

Instantly share code, notes, and snippets.

@janbenetka
Created September 16, 2021 13:28
Show Gist options
  • Save janbenetka/6462c2f484ce147e35ba2c4dc15228f2 to your computer and use it in GitHub Desktop.
Save janbenetka/6462c2f484ce147e35ba2c4dc15228f2 to your computer and use it in GitHub Desktop.
[Site Selection - CBGs] #mango #bigquery
unique_venues = sites_with_foot_traffic.drop_duplicates(subset=['name'])
# initialize map
map = folium.Map(location = [30.3006387,-97.7587983],
zoom_start = 11,
tiles='Stamen Toner')
# add pins of candidate locations
for _, r in unique_venues.iterrows():
geo_j = gpd.GeoSeries(r['geo']).to_json()
geo_j = folium.GeoJson(data=geo_j, style_function=lambda x: {'fillColor': 'red'})
folium.Popup(r['us_cbgs_2018_name']).add_to(geo_j)
geo_j.add_to(map)
map.add_child(folium.Marker(location = [r.latitude, r.longitude], popup = str(r["name"]), icon = folium.Icon(color = "red")))
# show the map
map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment