# Custom Map Downloader — Changelog

## 0.2.0 (2025-02-20) — Major Feature Update

### New Features
- **MBTiles Export**
  - Export any QGIS layer as a tiled MBTiles SQLite database for web/mobile use
  - Configurable extent: Center Point + Radius (meters) OR Bounding Box (lat/lon corners)
  - Zoom control: Zoom Range (min/max) OR Single Shot (single zoom level)
  - Tile size: 64–1024 px (default 256)
  - Neighbour padding: 0–5 rings of surrounding tiles (default 1) to avoid edge clipping
  - Auto-detect minimum visible zoom: finds the first zoom where the bbox spans >1 tile
  - Live tile count and size estimate (KB/MB/GB) in the UI
  - Determinate progress bar with % and per-tile updates
- **Progress Improvements**
  - Determinate progress bars for both GeoTIFF and MBTiles exports
  - GeoTIFF: stages (extent → render → write bands → done)
  - MBTiles: per-tile progress with zoom level and percentage
  - Fixed UI responsiveness during rendering using QEventLoop
- **UI Enhancements**
  - Dynamic format switching between GeoTIFF and MBTiles
  - Auto-detect button for minimum visible zoom
  - Real-time tile count and size estimate
  - Neighbour padding control with tooltip
  - Improved tooltips and layout

### Technical Changes
- Added tile-math helpers: `_lon_to_tile_x`, `_lat_to_tile_y`, `_tile_bounds_deg`, `_tile_bounds_3857`, `_min_visible_zoom`, `_tile_count_padded`
- MBTiles export creates valid SQLite schema with metadata table and tiles table with TMS y-flip
- Progress dialog uses Qt.WindowModal and QEventLoop for non-blocking rendering
- Tile range clamping prevents out-of-bounds at low zoom levels (0, 1, 2)
- Size estimate uses ~50 KB per PNG tile average

### Bug Fixes
- Fixed progress dialog appearing blank by switching from indeterminate to determinate mode
- Fixed UI freeze during rendering by using QEventLoop instead of polling isActive()
- Removed unused imports and dead code (`_png_bytes`)

---

## 0.1.3 (2025-02-20) — MBTiles Export (UI Only)

### New Features
- Added MBTiles export option in UI (format selector)
- Dynamic UI panels: GeoTIFF vs MBTiles
- MBTiles extent controls: Center Point + Radius OR Bounding Box
- Zoom controls: Zoom Range OR Single Shot
- Tile size selector (64–1024 px)
- Auto-detect minimum visible zoom button
- Live tile count estimate

### Technical Changes
- Rewrote UI to be built programmatically (no XML size issues)
- Added signal wiring for all interactive elements
- Parameter extraction for MBTiles mode

---

## 0.1.2 (2025-02-19) — CRS Selection & Fixes

### New Features
- CRS dropdown with 30+ EPSG codes
- Default to EPSG:3857 (Web Mercator)
- CRS passed to GeoTIFF export for correct projection

### Bug Fixes
- Fixed extent calculation for geographic vs projected CRS
- Correct GSD conversion for degrees vs meters
- Proper georeferencing for both CRS types

---

## 0.1.1 (2025-02-18) — Initial Release

### Features
- GeoTIFF export from any QGIS layer
- Center point, GSD, width/height input
- Automatic extent calculation
- Optional georeferencing toggle
- Automatic layer loading option
- Progress feedback
- GDAL-based geospatial metadata

### Supported Layers
- Satellite imagery
- XYZ tiles
- Raster layers
- Vector tile layers

### Use Cases
- Simulation
- Training data generation
- Offline map extraction
- Custom analysis workflows

---
