CLI tool that picks a random point on Earth, fetches a Google Maps satellite image, classifies pixels into land-cover categories, and recolors the image using a randomly selected art palette. Outputs a styled PNG with embedded coordinate metadata.
- Python 3.11+
- A Google Maps API key with the Maps Static API enabled
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCopy the example env file and add your key:
cp .env.example .env
# Edit .env and replace your_key_here with your actual API keyYour Google Cloud project must have the Maps Static API enabled. You can enable it at: Google Cloud Console → APIs & Services → Library
# Basic: 5km x 5km area at a random location
python main.py --area 5
# Reproducible run with a fixed seed
python main.py --area 10 --seed 42
# Custom output filename
python main.py --area 2 --output my_art.png| Argument | Required | Description |
|---|---|---|
--area |
Yes | Geographic area in km (e.g., 5 for ~5km x 5km) |
--seed |
No | Random seed for reproducible runs |
--output |
No | Output filename (default: output_<lat>_<lon>.png) |
Selects a uniformly distributed point on Earth's surface using arcsine sampling to avoid polar bias.
Converts the area (km) to a Google Maps zoom level and fetches a 640x640 satellite image via the Static Maps API.
Classifies each pixel into one of six land-cover categories using HSV color thresholds:
| Category | What it detects |
|---|---|
| Snow/Ice | Very bright, low saturation |
| Water | Blue hues |
| Vegetation | Green hues |
| Desert/Sand | Yellow-tan hues |
| Urban/Built | Gray, low saturation |
| Bare Earth | Everything else (fallback) |
Each thematic class is mapped to a color from a randomly chosen palette. The classification percentages and selected palette are logged to the console.
Saves a PNG with embedded metadata (readable with any PNG metadata viewer):
- Latitude / Longitude
- Area (km) and zoom level
- Palette name
| Palette | Style |
|---|---|
| Mondrian | Primary color blocks |
| Bauhaus | Bold geometric |
| Pastel Dream | Soft pastels |
| Earth Tones | Natural muted |
| Sunset | Warm gradient |
| Nord | Arctic cool |
| Solarized | Ethan Schoonover |
| Retro 70s | Orange/brown warmth |
| Vaporwave | Neon synthwave |
| Ocean | Marine blues |
| Forest | Deep woodland |
| Candy | Bright sweets |
from PIL import Image
img = Image.open("output_14.352849_150.059797.png")
print(img.text)
# {'latitude': '14.352849', 'longitude': '150.059797', 'area_km': '5.0', ...}