Skip to content

Instantly share code, notes, and snippets.

@rcgalbo
Created July 25, 2018 21:50
Show Gist options
  • Save rcgalbo/029b914e627922632bc2cfdf4e6092f8 to your computer and use it in GitHub Desktop.
Save rcgalbo/029b914e627922632bc2cfdf4e6092f8 to your computer and use it in GitHub Desktop.
Plotting an interactive heatmap of lat, long
import folium
def plot_heatmap(data):
'''
Args:
takes a list of lists [[lat, long]]
Returns:
Folium map object with heatmap overlay
'''
heatmap = folium.Map(tiles="CartoDBpositron", prefer_canvas=True)
hm = plugins.HeatMap(data)
heatmap.add_child(hm)
heatmap.fit_bounds(heatmap.get_bounds())
return heatmap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment