Skip to main content ramblings of a lost one

Journelly Heatmap

Following on from A journal in orgmode? yes Journelly! I have expertly crafted (read massively bodged) a python script to create a heatmap of locations using folium.

It simply reads in your Journelly.org file, checks for the lat/lon lines & stores them into a pandas dataframe (I was thinking of doing more with the df) and updates the folium map object before saving the interactive HTML file.

python code snippet start

import pandas as pd
import folium
from folium.plugins import HeatMap

flag = i = lat = lon = 0
#create map object centred around your location & define save location
map_object = folium.Map(location = [52.88489542624623, -1.42548966136386], zoom_start = 10 )

with open("/Users/leehalls/Documents/dumpground/Journelly.org") as file:
  for item in file:
    if "LATITUDE" in item:
        lat = item[11:20]
    if "LONGITUDE" in item:
        lon = item[12:21]
        i += 1
    if flag == 0:
        done = 1 #create dataframe
        df = pd.DataFrame({"lat":[lat],"lon":[lon]})
    if done == 1:
        if flag != i:
            flag = i
            data = {"lat":[lat], "lon":[lon]}
            df_new_rows = pd.DataFrame(data) #create new dataframe with last values
            df = pd.concat([df, df_new_rows]) #add last values to cumulative dataframe
            HeatMap(df_new_rows).add_to(map_object) #add last location to heatmap

map_object.save(r"/Users/leehalls/Documents/dumpground/map.html")

python code snippet end