Skip to content

Instantly share code, notes, and snippets.

@loopingleo
Last active September 3, 2018 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loopingleo/dc846873c6ac93168e2502894b834282 to your computer and use it in GitHub Desktop.
Save loopingleo/dc846873c6ac93168e2502894b834282 to your computer and use it in GitHub Desktop.
## ---------- PLOT ON OSM MAP with folium ----------------------------
locationlist = df_compressed[["lat","lon"]].dropna().values.tolist()
map = folium.Map(location=[np.mean(df_compressed['lat']), np.mean(df_compressed['lon'])], zoom_start=7)
for point in range(0, len(locationlist), 20):
if abs(df_compressed.speed[point]) < 3 / 3.6:
folium.Circle(locationlist[point], radius=1,#/(1+ (df_compressed["speed"][point])**(2)),
color='#00d4ff', fill=True, fill_color ='#00d4ff', fill_opacity=0.2,
stroke = True, weight = 0.1).add_to(map)
folium.TileLayer('cartodbdark_matter').add_to(map)
#folium.TileLayer('cartodbpositron').add_to(map)
#folium.TileLayer('Stamen Toner').add_to(map)
map
filepath = 'your_map_filename.html'
map.save(filepath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment