1

I am trying to replicate the following heatmap from this link. Seems simple, but my html output is just a tile map with none of the data I'm trying to represent.

Here's what my csv data looks like for_map:

enter image description here

And here is my code:

from folium import FeatureGroup, LayerControl, Map, Marker
from folium.plugins import HeatMap

for_map = pd.read_csv('ny_tickets_coord.csv', sep=';')

hmap = folium.Map(location=ny_coord, zoom_start=12)


hm_wide = HeatMap( zip(for_map.Y.values, for_map.X.values),
                     min_opacity=0.2,
                     radius=17, blur=15,
                     max_zoom=1
                 )
hmap.add_child(hm_wide)
hmap.save('heatmap.html')

Any ideas as to why my data is not showing up in the map?

3

Apologies for the thread necromancy, but after having had to Google this for the Nth time, I wanted to go ahead and record here that the only thing wrong with the OP's code here is that HeatMap wants a list, not an iterator. It should be:

hm_wide = HeatMap( list(zip(for_map.Y.values, for_map.X.values)),
                     min_opacity=0.2,
                     radius=17, blur=15,
                     max_zoom=1 
                 )
  • It's ok. In fact, there is a necromancer badge for that very purpose :) – DarkCygnus Aug 21 at 23:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.