If you, like me, use Location History in Google services to enhance and unlock a more personalized experience, now thanks to a few nifty python scripts you can visualize all that history and render it on a jpeg image.
You can already do this using Google's location history dashboard here, but you are limited to only a selected range up to a maximum of 30 days, if you want to visualize all your Location history then that's not an option.
What you'll need
If you choose the simple route just download my zip file here: Visualizing Location History.zip which contains everything you need including some batch files to make the process easier, just extract it somewhere. Python and PIL(Python Imaging Library) are in the install folder, you will need to install these in step 1.
For the rest of you, heres what you'll need.
- Python (https://www.python.org/downloads/) Make sure to get version 2.7.x at time of writing PIL does not support version 3.x.x
- PIL, the Python Imaging Library (http://www.pythonware.com/products/pil/) make sure to get the right version for your version of python e.g. if Python 2.7 get PIL for Python 2.7
- The following scripts:
- Location History JSON Converter (https://github.com/Scarygami/location-history-json-converter)
- Latitude History Plotter (https://github.com/snowdonjames/LatitudeHistoryPlotter)
Step 1: So to start things off we'll get the easy parts out the way, first install Python and PIL, these are simple installations.
Step 2: Next you will need to get a copy of your location history from Google Takeout (https://www.google.com/settings/takeout)
Click the create archive button then click select all to deselect all the other options, we only want the location history for this tutorial. Select the Location History check box then click create Archive at the top of the page. It may take a little while to create your archive but it shouldn't take too long being just a json file, Google will send you an email when its ready for download.
Step 2: Next you will need to get a copy of your location history from Google Takeout (https://www.google.com/settings/takeout)
Click the create archive button then click select all to deselect all the other options, we only want the location history for this tutorial. Select the Location History check box then click create Archive at the top of the page. It may take a little while to create your archive but it shouldn't take too long being just a json file, Google will send you an email when its ready for download.
Step 3: Once you've got your location history downloaded extract it into the folder called "converter", then just double click the .bat file I created and that will convert your JSON file into a KML file for use when we draw the location history ontop of your map.
Step 4: Copy the KML file created in the previous step and put it in the "generate" folder.
Step 5: Before we can draw the location history we need an image to draw it on, this step can be a little tricky, what we need to do is get a satellite image, but we have to know what coordinates are at the top left corner and at the bottom right corner. There are probably other ways to do this but I'm going to show you the way I have done it.
First you will want to open up Google maps, find the area you want to save for your location history, now look at where your top left corner is going to be, try to find a place you can remember for when you crop the image such as a unique curve in a road, or a darker blue in the water, it all depends on where you are in the world.
you will want to do the same with the bottom right corner, find something unique that you can remember, once you have done this for each corner you will need to right click and click the option "What's here?" a card will pop up with the coordinates of that location, copy these down. I will now visually show this process.
Here I have selected my first point in this area between here the water is darker and lighter, somewhere unique that I can remember. I have right clicked and then clicked "What's here?" |
So this is what my csv file now looks like:
map.jpg,-34.586334,-35.019697,138.294263,138.942461,0,0
Save your CSV file and that's that, all the hard work is done.
Step 7: Now all you have to do is double click the generate.bat file and after a little while a file will appear called "LatitudeData.png" this is your final image.
I hope you enjoyed this tutorial, it's my first ever! this was a little complex especially for beginners but I hope you were successful and got it all to work!
and thats how luke see's it!