GeoJson2KML Converter is a Python script that can be used to convert GeoJSON files - especially those exported from Google Maps - into KML format. The KML data is split from the raw data of the Google Maps timeline into individual files in order to filter certain time periods. These KML files are specially prepared for use in Google Earth and are also used to back up your own timeline on local systems. In this way, the data in the Google Maps account can be regularly deleted if you first organize regular downloads of the JSON files via "https://takeout.google.com/". This way, the timeline is always backed up, even if it is regularly deleted.
Make sure that the following requirements are met on your system.
- Python 3.x is installed. Check this with the command:
python3 --version
If Python is not installed, you can install it on a Debian-based system (such as Ubuntu) using the following command:
sudo apt update
sudo apt install python3 python3-pip
- pip (Python package manager) must be installed:
sudo apt install python3-pip
- Virtual environment (optional but recommended): To have a clean and isolated environment for your project, set up a virtual environment:
sudo apt install python3-venv
Clone the project from GitHub to your system:
git clone https://github.com/itlinuxmaker/GeoJson2KMLConverter.git
cd GeoJson2KMLConverter
Create and activate a virtual environment:
python3 -m venv venv
source venv/bin/activate
Install the necessary Python packages. If there is a requirements.txt, use this command:
pip install -r requirements.txt
With these steps you can install and use GeoJson2KML Converter on a Linux system.
- Python 3.x is installed. You can check this by opening the command line (CMD) and entering the following command:
python --version
If Python is not installed, you can download and install it from the official website: https://www.python.org/downloads/. Make sure to enable the "Add Python to PATH" option during installation.
- pip (Python package manager) should already be installed with Python. Check this with:
pip --version
Copy the repository from GitHub. You can either install Git and clone the repository, or download the ZIP archive directly from GitHub:
- Method 1: Clone repository (if Git is installed):
- Install Git from https://git-scm.com/
- Open the command line and enter the following command:
git clone https://github.com/itlinuxmaker/GeoJson2KMLConverter.git cd GeoJson2KMLConverter
- Method 2: Download ZIP archive:
- Go to https://github.com/itlinuxmaker/GeoJson2KMLConverter and click the "Code" button, then select "Download ZIP".
- Extract the archive to a desired location on your computer.
It is recommended to use a virtual environment to install the dependencies in an isolated environment.
- Open the command line and navigate to the project directory:
cd Path\to\GeoJson2KMLConverter
- Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv\Scripts\activate
You should see that your prompt now starts with (venv), indicating that the virtual environment is active.
Once the virtual environment is enabled (or without a virtual environment), install the required Python dependencies using pip:
pip install -r requirements.txt
This guide will help you install and use the GeoJson2KML Converter on Windows. The steps to set up the virtual environment are optional but helpful to create an isolated environment for your project.
- After you have downloaded the product "Maps - your settings and personal places in Maps" (only this product, no others!) to your computer via Google Takeout as a ZIP or TAR.GZ archive, unpack the archive. Then change to the directory in which the year folders (e.g. 2023, 2024) are located. By default, this directory is located in the path:
Takeout/Location History (Timeline)/Semantic Location History
Alternatively, you can copy or move the year folders to another location and navigate to that directory.
- Start the script:
- For Linux/macOS:
python3 /path/to/your/geoJson2Kml.py
- For Windows:
python \path\to\your\geoJson2Kml.py
-
Inputs:
Enter the start date and end date in the format YYYY-MM-DD. Choose whether you also want to add the routes (lines).
The script creates a KML file in the current directory. The file name contains the start and end date of the period.
This allows you to optimally and individually save your timelines from Google Maps on your own storage media and display them in external tools.