I'm currently trying to use the Python and Folium to generate a heatmap on Leaflet.js and I'm getting some weird results.
I read in the longitude and latitudes from a csv file and then try to generate 'heatmap entries' using Folium.
If I print the variables during execution I see the following (somewhat pseudocode):
print row[0]
-1.44986889
However, when I call it like this:
heatmap_map = folium.Map(location=[51.67109, -1.28278], zoom_start=2)
print '[*] Reading in and parsing the CSV file.'
with open('geoloc.csv','rb') as f:
reader = csv.reader(f)
for row in reader:
heatmap_map.add_children(plugins.HeatMap([row[0]]))
heatmap_map.save("/tmp/heatmap.html")
What gets written into the heatmap.html file looks like this:
var heat_map_b207be06b0c945a39fc48ed43ff5493b = L.heatLayer(
[['-', '1', '.', '4', '4', '9', '8', '6', '8', '8', '9']],
As you can see the string gets broken up and each and every character gets delimeted with '' and,.
I have absolutely no idea what causes this or how to get around it. Any ideas out there?