luka1199 / geo-heatmap

:world_map: Generate an interactive geo heatmap from your Google location data
MIT License
2.04k stars 226 forks source link

There is no file named locations.json in the google download #57

Open johnrsibert opened 2 years ago

johnrsibert commented 2 years ago

$ uname -a Linux kihikihi 5.4.0-124-generic #140-Ubuntu SMP Thu Aug 4 02:23:37 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ python3 --version Python 3.8.10

$ python3 geo_heatmap.py ~/Projects/Trips/Takeout/Location\ History/Semantic\ Location\ History/2022/2022_AUGUST.json

(1/3) Loading data from /home/jsibert/Projects/Trips/Takeout/Location History/Semantic Location History/2022/2022_AUGUST.json Traceback (most recent call last): File "geo_heatmap.py", line 327, in generator.run(data_file, output_file, date_range, stream_data, settings) File "geo_heatmap.py", line 258, in run self.loadJSONData(json_file, date_range) File "geo_heatmap.py", line 57, in loadJSONData first_element = data["locations"][0] KeyError: 'locations'

johnrsibert commented 2 years ago

The user misinterpreted the error message. This is a user problem not a bug and the user will track it down.

johnrsibert commented 2 years ago

It seem in my cursory reading of the README, that I misunderstood the file names and directory structure. Also my takeout download from google does not contain files named "locations.json" or "Location History.json". Instead my takeout contains "Records.json." So the following command seems to work as expected in a bash terminal under linux: ./geo_heatmap.py ~/Projects/Trips/Takeout/Location\ History/Records.json --min-date 2022-08-19 --max-date 2022-08-19

Does google arbitrarily change file name? Or is it browser (I use Firefox) or OS (I use linux) dependent/

Note the '\' character to escape the space in the path name. Also it was necessary to convert the DOS line endings in the python source to unix line endings (with fromdos).

luka1199 commented 2 years ago

I think they changed the file name with the update of the location history format a couple of months ago.