# 02Multimap

Multi-panel synchronised map canvases for comparative spatial analysis • v0.6.0

## 1. Overview

02Multimap is an advanced QGIS workspace plugin that creates a multi-panel synchronised map viewer. It provides 2, 3, 4, 6, or 8 independent map canvases in a coordinated grid layout, with real-time navigation syncing, a laser crosshair cursor tracking across all panels, three per-panel render modes, interactive spatial difference engine, timeline transition player, coordinated multi-panel inspector, print layout export, and offline self-contained HTML dashboard exports with presentation slide mode. It targets urban planners, spatial analysts, environmental scientists, and demographers who need to compare spatial patterns side-by-side without frictionless overhead. The plugin is toolbar-only, has zero external Python dependencies, and is compatible with PyQt5 and PyQt6 via qgis.PyQt compatibility APIs.

## 2. Feature Documentation

### 2.1 Dynamic Layout Grids

#### Six Panel Configurations

A combobox offers 2 Panels (1×2), 2 Panels (2×1), 3 Panels (1×3), 4 Panels (2×2), 6 Panels (2×3), and 8 Panels (2×4). Single-row layouts use a single horizontal `QSplitter`; multi-row layouts nest two horizontal splitters inside a vertical splitter, initialised with equal sizing. Changing the grid destroys and recreates all panels, each inheriting the main canvas CRS and extent.

### 2.2 Bi-Directional Navigation Sync

#### Synchronised Panning and Zooming

Sync Navigation (default on): When any panel's extent changes, all other panels copy that extent. An internal `_is_syncing` boolean lock prevents cascade loops.

Sync Canvas (default on): Panel extents push to the main QGIS canvas and vice versa. Both checkboxes must be on for main-canvas-to-panel propagation.

### 2.3 Laser Crosshair Tracking

#### Coordinated Cursor Across All Views

When moving the mouse over any panel, a green neon `QgsVertexMarker` (cross, 24 px) appears at the matching geographic coordinate on all other panels. A red marker appears on the main QGIS canvas. Coordinates display in a status bar readout. Toggleable via the Laser Crosshair checkbox.

### 2.4 Smart Auto-Fill & Time-Series Auto-Fill

#### "Choose for Me — Current Extent" & Time-Series Auto-Fill

Choose for Me: Automatically assigns a different spatial layer to each panel, prioritising layers intersecting the current canvas extent.

Time-Series Auto-Fill: Sorts project layers chronologically by date/year in their layer names and populates viewports in timeline order.

### 2.5 Multi-Panel Coordinated Feature Inspector (🎯 Multi-Inspect)

#### Synchronised Vector & Raster Point Queries

Clicking any coordinate point on a panel queries vector feature attributes and raster cell values at that point across all active panels (Panel 1–8) simultaneously, rendering a summary popover dialog.

### 2.6 Visual Spatial Difference Engine (⚡ Show Diff)

#### Green/Red Highlight Overlays & Overlap %

Computes geometric difference between Panel 1 and Panel 2 layers inside the visible extent. Renders semi-transparent Green (added geometries) and Red (removed geometries) rubberband overlays on canvas with a live Overlap % readout ratio in the status bar.

### 2.7 Timeline & Scenario Transition Player (▶ Play Timeline)

#### Sequential Panel & Layer Animation

Auto-cycles active panel focus or cross-fades timeline layers sequentially across panels using an internal playback timer (1.5s interval).

### 2.8 Viewport Spatial KPIs (📊 Viewport KPIs) & Canvas HUD (🧭 Canvas HUD)

#### Real-Time Metric Chips & Canvas Graphics

Viewport KPIs: Dynamically calculates visible bounding box polygon areas (in `ha` or `km²`) and feature counts as metric chips below each panel card.

Canvas HUD: Overlays a North arrow indicator (`▲ N`) and scale readout on viewport corners.

### 2.9 Workspace Presets & Scenario Templates (💾 Presets) & Legend Drawer (📋 Legend Drawer)

#### Template Management & Stacked Legends

Presets: Save workspace configurations to `QSettings` or load built-in templates (Before & After 1x2, 4-Scenario Matrix 2x2, Temporal Timeline 1x3).

Legend Drawer: Collapsible right-side sidebar panel stacking micro-legends for all active viewports into a single column.

## 3. Panel Render Modes

Each panel has a per-panel mode combobox with three options:

Mode | Behaviour
--- | ---
Follow Main Map | Copies layers directly from the main QGIS canvas
Compare One Layer | Shows one selected layer from the panel's layer combo, optionally stacked above a shared global background layer (from the top toolbar's base layer combo)
Use Map Theme | Applies a QGIS Map Theme's visible layers via `mapThemeCollection().mapThemeVisibleLayers()`

## 4. Print Layout and HTML Dashboard Export

#### Print Layout Export

Opens a configuration dialog for: map title, page size (A4/A3/Letter), orientation (Landscape/Portrait), north arrow style, scalebar style, and export format (PNG, JPEG, PDF, SVG, or Interactive HTML Dashboard). Builds an in-memory `QgsLayout` with grid maps, north arrow, and scalebar via `QgsLayoutExporter`.

#### Multi-Theme Offline HTML Dashboard with Presentation Slide Mode

Renders each panel canvas to high-res PNG and assembles a self-contained HTML dashboard featuring Slate Light, Dark Midnight, and Emerald Clean themes, interactive distance/area measurement tools (📏), laser crosshairs, scale chips, and a full-screen 📺 Presentation Slide Mode with keyboard arrow key navigation (← / →).

## 5. Controls Summary

Control | Type | Description
--- | --- | ---
Panels | Combo | 6 grid configurations (2/3/4/6/8 panels)
Choose for Me | QPushButton | Auto-assigns layers to panels from current extent
Time-Series Auto-Fill | QPushButton | Assigns layers chronologically by date/year
Presets / Templates | Combo | Save/load workspace presets and scenario templates
Sync Navigation / Sync Canvas | QCheckBox (2) | Bi-directional pan/zoom sync between panels & QGIS canvas
Laser Crosshair / Extent Box | QCheckBox (2) | Coordinated cursor marker and active extent box overlay
Viewport KPIs / Canvas HUD | QCheckBox (2) | Real-time polygon area chips and North Arrow graphic HUD
🎯 Multi-Inspect | QPushButton (Checkable) | Click any coordinate to query all panels simultaneously
⚡ Show Diff | QPushButton (Checkable) | Green (added) / Red (removed) geometry difference highlights
📋 Legend Drawer | QPushButton | Right-side sidebar stacking all panel legends
▶ Play Timeline | QPushButton | Auto-cycles focus panel highlight across time-series
Match Scale / Extent / Fit All | QPushButton (3) | Manual scale/extent alignment between panels
Scale Preset... | Combo | Jump all panels to standard cartographic scales (1:1k to 1:250k)
Refresh / Export / Quick Guide | QPushButton (3) | Canvas refresh, print layout/HTML export, user guide

## 6. Workflow Guide

1. Load several spatial layers into a QGIS project and set up at least one map theme (optional, for theme-mode panels).
2. Click the 02Multimap toolbar icon to open the floating dialog.
3. Choose a panel count from the combobox (e.g., 4 Panels 2×2).
4. Optionally click Choose for Me to auto-assign layers intersecting the current extent.
5. Set each panel's mode: Follow Main Map, Compare One Layer (pick a layer from the combo), or Use Map Theme.
6. Optionally select a global background layer from the top toolbar.
7. Toggle Sync Navigation, canvas sync, and laser crosshair as needed.
8. Pan and zoom in any panel; all others follow. The laser crosshair tracks cursor position across all views.
9. Use Match Scale/Match Extent/Fit All for alignment. Export to print layout or HTML dashboard for sharing.

## 7. Technical Notes

- Layer identification: Layer combos store data by stable QGIS layer ID to avoid problems with duplicate layer names.
- Project signal integration: The dialog connects to `layerWasAdded`, `layerRemoved`, `mapThemeCollection().mapThemesChanged`, `iface.mapCanvas().layersChanged`, and `extentsChanged` to stay in sync with the project state.
- PyQt5/PyQt6 compatibility: 8 patterns for dynamic attribute access on enums (`Qt.WindowType`, `QEvent.Type`, `Qt.AlignmentFlag`, `QFont.Weight`, `QIODevice.OpenModeFlag`, `Qt.Orientation`, `QFrame.Shape`/`Shadow`) and event position extraction.
- Print layout fidelity: Theme-mode panels use `setFollowVisibilityPresetName()` / `setFollowVisibilityPreset(True)` for accuracy. Layer-mode panels use `layerStyleOverrides()`.
- Atomic file writes: HTML export uses `QSaveFile` for safe atomic commit.
- QGIS compatibility: 3.40 LTR through 4.x. Zero external Python dependencies.

## 8. Literature

1. Roberts, J. C. (2007). State of the art: Coordinated & multiple views in exploratory visualization. Proceedings of the Fifth International Conference on Coordinated and Multiple Views in Exploratory Visualization, 61–71. DOI: 10.1109/CMV.2007.20
2. Dykes, J., MacEachren, A. M., & Kraak, M. J. (Eds.). (2005). Exploring Geovisualization. Elsevier.
3. Elmqvist, N. & Tsigas, P. (2008). A taxonomy of 3D occlusion management for visualization. IEEE Transactions on Visualization and Computer Graphics, 14(5), 1095–1109. DOI: 10.1109/TVCG.2008.59
4. Andrienko, G., Andrienko, N., Dykes, J., Fabrikant, S. I., & Wachowicz, M. (2008). Geovisualization of dynamics, movement and change: key issues and developing approaches. The Cartographic Journal, 45(3), 185–200. DOI: 10.1179/000870408X311428