This Python script generates Google Maps/ Leaflet tiles from a given image in WebP format. It's designed to run either through a command line interface with arguments or interactively with a user interface.
- Generate Map tiles at specified zoom levels.
- Save tiles as optimized WebP images with quality 75 and effort 5.
- Support for both command line and GUI operations.
- Python 3.x
- Pillow (PIL Fork)
- tqdm
Git clone the repo
git clone https://github.com/sn0w12/Google-Maps-Tile-Generator
Before running the script, ensure you have Python installed. You can install the required packages using:
pip install -r requirements.txt
Or simply run the run.bat file, it should automatically detect the dependencies you need and download them for you.
To run the script with command line arguments:
python map.py -i <input_image_path> -o <output_directory> --min_zoom <min_zoom> --max_zoom <max_zoom> --background_color <background_color>
Arguments:
-ior--input_image_path: Path to the input image.-oor--output_directory: Path to the output directory for the tiles.--min_zoom: Minimum zoom level (0).--max_zoom: Maximum zoom level.--background_color: Background color for the image. Can be 'transparent' or a hex code without '#'.
If the script is run without any arguments, it will prompt the user to select the input image and output directory through a GUI dialog. Then it will prompt the user for the min zoom, max zoom and background color in the console.
Ensure all scripts, batch files, and the requirements.txt file are in the same directory for the batch operation to function correctly.