Location heatmap for Journelly

Following on from a journal in orgmode/IOS 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.

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")
heatmap_01.png
heatmap_02.png

Date: 2025-05-05 Mon 00:00

Emacs 30.0.92 (Org mode 9.7.11)