luka1199 / geo-heatmap

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

JSON file has no `timestampMs` field #53

Closed divulgacheur closed 2 years ago

divulgacheur commented 2 years ago

Describe the bug Downloaded location data file contains timestamp field instead of timestampMs field.

$ python3 geo_heatmap.py ~/Downloads/takeout-20220203T164644Z-001/Takeout/Historique\ des\ positions/Records.json -s

(1/3) Loading data from /home/theo/Downloads/takeout-20220203T164644Z-001/Takeout/Historique des positions/Records.json

Traceback (most recent call last):
  File "/home/theo/git/geo-heatmap/geo_heatmap.py", line 303, in <module>
    generator.run(data_file, output_file, date_range, stream_data, settings)
  File "/home/theo/git/geo-heatmap/geo_heatmap.py", line 232, in run
    self.streamJSONData(json_file, date_range)
  File "/home/theo/git/geo-heatmap/geo_heatmap.py", line 75, in streamJSONData
    if timestampInRange(loc["timestampMs"], date_range):
KeyError: 'timestampMs'

To Reproduce Steps to reproduce the behavior:

  1. Get your location data at https://takeout.google.com/
  2. Run the script

Expected behavior Normal generation of heatmap.html file.

Screenshots Content of Records.json file

$ head -20  ~/Downloads/takeout-20220203T164644Z-001/Takeout/Historique\ des\ positions/Records.json 
{
  "locations": [{
    "latitudeE7": 413522827,
    "longitudeE7": 6672174,
    "accuracy": 20,
    "source": "WIFI",
    "deviceTag": 1611787950,
    "timestamp": "2013-12-30T20:30:26.396Z"
  }, {
    "latitudeE7": 417153171,
    "longitudeE7": 75560909,
    "accuracy": 736,
    "source": "CELL",
    "deviceTag": 1611787950,
    "timestamp": "2014-01-01T07:44:41.819Z"
  }, {
    "latitudeE7": 417153171,
    "longitudeE7": 75560909,
    "accuracy": 736,`
    "source": "CELL",

The file does not contain any timestampMs field :

$ grep -ri timestampMs ~/Downloads/takeout-20220203T164644Z-001/Takeout/Historique\ des\ positions/
$

Desktop:

luka1199 commented 2 years ago

It looks like Google has changed the format. I will have a look at the bug in the next few days.