Created
November 22, 2017 17:34
-
-
Save WanderingHogan/90093d01bf449ae4daf419d850ec9ee1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| let dataToWrite = ''; | |
| const fs = require('fs'); | |
| const testData = require('./your/takeout/file.json') | |
| for (item in testData.locations){ | |
| let lat = String(testData.locations[item].latitudeE7).substr(0, (String(testData.locations[item].latitudeE7).length - 7)) + '.' + String(testData.locations[item].latitudeE7).substr((String(testData.locations[item].latitudeE7).length - 7)) | |
| let lng = String(testData.locations[item].longitudeE7).substr(0, (String(testData.locations[item].longitudeE7).length - 7)) + '.' + String(testData.locations[item].longitudeE7).substr((String(testData.locations[item].longitudeE7).length - 7)) | |
| dataToWrite = dataToWrite + `${testData.locations[item].timestampMs},${lat},${lng}\n` | |
| } | |
| fs.writeFile('what-you-want-t0-call-it.csv', dataToWrite, 'utf8', function (err) { | |
| if (err) { | |
| console.log('Some error occured - file either not saved or corrupted file saved.'); | |
| } else{ | |
| console.log('it saved'); | |
| } | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this converts the takeout json file into a CSV file you can load in your GIS software and plot the lat/lng with timestamp.
A lot of other cool data is stripped out. resulting CSV is way smaller than the huge json file