A collection of Python scripts for manipulating Google My Maps KML files. These tools allow you to split, combine, convert, and extract data from KML files.
Takes a large KML/KMZ file and splits it into multiple smaller KML files while preserving all placemark data and styles. Useful when your KML file is too large to import into Google My Maps (which has a size limit).
Merges multiple KML/KMZ files from a folder into a single or multiple KML files. Handles style conflicts by remapping style IDs and preserves all placemark data. Useful for combining multiple maps into one.
Converts CSV or JSON files containing location data into KML format. Expects columns/fields for coordinates (lat/lon), names, descriptions, and optionally styles and layer information. Perfect for bulk-converting location databases to Google My Maps format.
Extracts all placemarks and their data from a Google My Maps URL or map ID into CSV and JSON formats. Captures names, descriptions, coordinates, styles, layers, and custom fields. Useful for backing up or migrating map data. This script may violate terms of service, use only if you have permission (this script will work even if you don't have the permissions on the map to extract the KML file directly). Expected input for map: https://goo.gl/maps/<MAP_ID> or https://www.google.com/maps/d/u/0/viewer?<whatever's next>
Analyzes placemarks in KML/KMZ files and splits them into separate files by country. Can use either embedded country data or reverse geocoding to determine locations. Helpful for organizing international datasets into region-specific maps.
- Python 3.7+
- Required packages:
requestsbeautifulsoup4reverse_geocoder(optional, for country extraction)pycountry(optional, for country extraction)
pip install -r requirements.txtpython split_kml.pyFollow the prompts to:
- Enter path to source KML/KMZ file
- Specify maximum placemarks per output file
- Choose output directory
python combine_kml_folder.pyFollow the prompts to:
- Select folder containing KML/KMZ files
- Choose output directory
- Set base name for combined files
- Specify maximum placemarks per output file (defaults to max 2000 points per layer, compatible to upload as a layer on google maps my maps)
python csv_or_json_to_kml.pyFollow the prompts to:
- Select input CSV/JSON file
- Choose output directory
- Set maximum placemarks per output file (defaults to max 2000 points per layer, compatible to upload as a layer on google maps my maps)
python KML_extractor.pyFollow the prompts to:
- Enter Google My Maps URL or map ID
- Set output filename base
python extract_country_kml.pyFollow the prompts to:
- Select input KML/KMZ file or folder
- Choose output directory
- Select countries to extract
- Set maximum placemarks per output file (defaults to max 2000 points per layer, compatible to upload as a layer on google maps my maps)
These scripts are provided "as is", without warranty of any kind. Use at your own risk. The author takes no responsibility for any issues or damages that may arise from using these tools.
Feel free to submit issues, fork the repository, and create pull requests for any improvements.
This project is licensed under the MIT License - see the LICENSE file for details.
This project is stable, updates unlikely unless bugs found. Happy mapping :)