[general]
name=RasterViz
qgisMinimumVersion=3.16
qgisMaximumVersion=3.99
description=RasterViz v2 — the Layout-native method: a native QGIS Layout item that draws a publication-style colour stretch bar (colorbar), linked live to a raster layer's own symbology — an alternative to the classic dialog-based RasterViz for when a scientific-style colorbar needs to live directly inside a native Print Layout. Pending repository approval — install from ZIP for now.
version=2.11.2
author=Defani Arman Alfitriansyah
email=defaniarman@gmail.com
about=RasterViz v2 (Layout-native method) is a single, focused Layout item that lives entirely inside QGIS's own Layout Designer — it appears in the Add Item toolbar/menu next to Legend, Scale Bar and Picture. This is not a replacement for the classic dialog-based RasterViz (colormap gallery, RGB composite, web basemaps, discrete classification, single-window PNG/SVG/TIFF/PDF export) — it's a different, alternative method: no separate window at all, just one native item that drops straight into a Print Layout and sits alongside QGIS's own native North Arrow, Scale Bar, Grid and Legend items, for anyone who wants a scientific-style colorbar without leaving the Layout Designer. All of its settings are edited in a dedicated "RasterViz" dock panel that the plugin adds to every Layout window automatically (right-hand side, next to Items/Undo History), not in the generic Item Properties tab and not in a separate popup window — so it's visible right away after installing. Drag it onto a print layout (or use the panel's own "+ Add Colorbar" button), pick a raster layer (Singleband pseudocolor or Singleband gray) from the dropdown, and it draws that layer's colour ramp as a resizable bar with orientation (horizontal/vertical), an explicit width/height (what you type is what the bar draws at — no separate "thickness" fraction to keep in sync), continuous or discrete/stepped bar style, number of sampled colours, optional rounded corners, a configurable number of ticks with adjustable padding, decimals, optional pointed "extend" ends, independently coloured/fonted tick numbers and label, and a label. It re-reads the layer's colours and Min/Max automatically whenever that layer's Symbology is changed on the canvas — and changing the colour ramp from its own panel refreshes the map canvas immediately too — so it always matches what's actually drawn on the map. Zero third-party dependencies — pure PyQGIS + PyQt5, no matplotlib, no extra window.
tracker=https://github.com/Defani/QRasterVIZ
repository=https://github.com/Defani/QRasterVIZ
homepage=https://github.com/Defani/QRasterVIZ
hasProcessingProvider=no
tags=colorbar,legend,layout,print layout,colormap,raster,tick,stretch,remote sensing,ndvi,scientific,rasterviz
category=Layout
icon=icon.png
experimental=False
deprecated=False
changelog=Version 2.11.2 (2026): Fixed the plugin being blocked by the QGIS Plugin Repository's automated security scan (Bandit "Try, Except, Pass detected", 20 findings across colorbar_item.py, colorbar_panel.py and qrviz.py). Every bare "except Exception: pass" that silently swallowed an error has been replaced with a QgsMessageLog.logMessage() call (logged under a "RasterViz" tab at Qgis.Warning level), so failures on these optional/best-effort paths (signal connect/disconnect, panel docking/tabifying, layout item positioning, colour ramp/statistics fallbacks, map canvas/Map-item refreshes) are now visible in the QGIS Log Messages panel instead of disappearing without a trace. No behavioural change on the happy path.
  Version 2.11.1 (2026): Fixed a plugin package installation error ("'%%' must be followed by '%%' or '(', found: '%%'") that blocked installing this ZIP entirely on some QGIS setups. Root cause: metadata.txt is parsed with Python's configparser, which treats a literal "%%" as the start of a %%(...) interpolation sequence; three older changelog entries below (2.1.0, 2.4.0, 2.4.1) contained a bare "%%" describing the since-removed "Bar thickness" setting, tripping that parser. Every literal "%%" in this file is now escaped as "%%%%" so the package installs cleanly.
  Version 2.11.0 (2026): Removed the native Position and Size / Rotation / Item ID / Rendering / Variables block from the bottom of the panel. Position the item by dragging it on the layout canvas instead; resizing stays covered by the Width/Height fields further up, which still stay in sync with dragging the item's own handles.
  Version 2.10.1 (2026): Collapsed the panel's item heading from two lines ("Colorbar (layer name)" followed by a second, hardcoded "Colorbar" right underneath — on top of the "RasterViz" the dock's own tab/title bar already shows above the panel) down to one, and added the plugin's own icon next to it.
  Version 2.10.0 (2026): Added "Min"/"Max" and "Interpolation" (Discrete/Linear/Exact) controls to the panel, right under Raster colour ramp — just the two pieces of the layer's own Symbology > Min/Max Value Settings that actually change what's drawn, not the whole Symbology tab (no percentile/std-dev range presets, statistics extent or accuracy picker, no Band selector, no label unit suffix/precision — those tune how a range gets computed or belong to unrelated parts of that tab, not this one). Editing them updates the linked raster's actual renderer the same way the colour ramp picker already does: map canvas and this layout's Map item(s) refresh immediately, no manual step needed.
  Version 2.9.2 (2026): Fixed the printed map inside the Layout still showing the raster's old colours after changing its ramp (or Reverse) from this panel, until the Layout Designer's own "Refresh view" was pressed — the colorbar itself already updated live, but the Layout's Map item caches its rendered image separately from the main map canvas and wasn't being told to invalidate that cache. Changing the ramp, reversing it, or linking a raster that gets auto-styled to pseudocolor now also invalidates and immediately redraws any Map item(s) in that same layout, so the printed map catches up right away too.
  Version 2.9.1 (2026): Fixed the RasterViz dock panel landing stacked in its own row underneath the native Items / Item Properties / Layout / Guides tab group on first install, instead of joining that group directly as another tab (as intended — see the panel's own docs above). It's now explicitly tabified with whichever of those native docks is found in the Layout window, so it shows up right in that same tab row from the very first time a Layout window is opened, with nothing to drag into place.
  Version 2.9.0 (2026): Picking a raster layer in the panel's "Raster layer" dropdown now automatically switches that layer to Singleband pseudocolor (with a default ramp and a range taken from the band's own statistics) if it isn't already styled that way, instead of leaving the Raster colour ramp / Reverse controls disabled until the user switched render type manually from the layer's own Symbology tab first. Renamed "Reverse colour order (this colorbar only)" to plain "Reverse colour order" and changed what it does: when the linked raster is Singleband pseudocolor, it now reverses that layer's own colour ramp (same effect as the "Reverse" button next to Raster colour ramp, updating the map canvas immediately) instead of only flipping this printed colorbar's own preview order — so the checkbox, the raster's symbology and the map canvas can no longer end up pointing in opposite colour directions. It still falls back to the old colorbar-only flip when there's no raster ramp to reverse (no layer linked, or the layer is styled some other way, e.g. Gray).
  Version 2.8.0 (2026, pending repository approval — install via ZIP until then, not yet searchable from Plugins → Manage and Install Plugins → All): this is RasterViz v2. Renamed the plugin's display name, dock panel title and GUI item name from "RasterViz Colorbar"/"QRViz Colorbar" to plain "RasterViz" (labels only — the underlying QGIS layout item type ID and every saved-project attribute name are unchanged, so layouts/projects made with older versions still open and load correctly). This is RasterViz's Layout-native method — a native Layout item you drop straight into Print Layout and combine with QGIS's own North Arrow/Scale Bar/Grid/Legend items — positioned as an alternative to the classic dialog-based RasterViz (colormap gallery, RGB composite, basemaps, single-window export), not a replacement for it; reach for whichever method fits the map you're building. No behavioural changes in this release beyond the naming/positioning updates described above.
  Version 2.7.0 (2026): Removed the plugin's own bundled/custom colour ramps (custom_ramps.py, the "QRVIZ"-tagged NDVI/mangrove/water/... palettes) — the "Raster colour ramp" picker now only shows QGIS's own built-in ramps, nothing plugin-specific to keep in sync. Picking a colour ramp (or hitting Reverse) now also explicitly refreshes the main map canvas right away, instead of only calling the layer's triggerRepaint() and waiting for a scheduled repaint — colour changes made in the panel now show up on the canvas immediately, with no manual refresh needed. Added a "Bar style" option: Continuous (the existing smooth gradient) or Discrete (stepped) — Discrete draws tick_count - 1 solid colour blocks, one per interval between two consecutive ticks, with a divider line at every block boundary so every tick lines up with a labelled boundary ("full" ticks), matching a classic stepped/boundary-norm colorbar look; works with the existing end-style pointed/arrow extends. Changed the default Tick padding for a brand-new colorbar item from 2.5 mm to 0.00 mm (also updated the reload fallback to match, so a freshly-added and a reloaded-with-no-saved-value item agree).
  Version 2.6.0 (2026): Brought back a domain-specific colour ramp collection (NDVI, mangrove, water, urban, terrain, LST, SAR, ...) as a new custom_ramps.py, registered natively into QGIS's own QgsStyle (as QgsGradientColorRamp entries, tagged/favourited "QRVIZ") instead of via Matplotlib — keeping the plugin's zero-third-party-dependency rule intact. Because they're plain QgsStyle colour ramps, they show up directly in the existing "Raster colour ramp" picker alongside QGIS's own built-ins, apply to the linked raster layer through the exact same code path as any other ramp (so the map canvas and printed colorbar stay in sync automatically), and support "Reverse" the same way any other ramp does.
  Version 2.5.0 (2026): Fixed a bug where changing the linked raster's colour ramp from the panel could make the colorbar go blank with "nan" tick labels. Root cause: the rebuilt QgsSingleBandPseudoColorRenderer never had its classificationMin/Max explicitly set, so it reported NaN for both — and since "nan <= nan" is always False, the colorbar's own min/max fallback check let that NaN pass straight through into every sampled colour (transparent, hence "blank") and every tick label ("nan"). The panel now explicitly carries the value range over onto the new renderer, with a robust fallback (existing shader range, then band statistics) if that range was itself unusable; the colorbar item also now guards against NaN defensively wherever it reads a renderer's classification range. Fixed Tick padding defaulting to a different value (1.5 mm) on a reloaded/saved project than on a freshly-added item (2.5 mm) — both now agree. Replaced the black/white-only "Text color" toggle with independent, full colour pickers for tick numbers and the axis label (Tick font / Label font rows), and added a font-family dropdown for each — not just size/bold/italic — so tick colour and font are now genuinely configurable rather than a two-option switch. Old projects saved with the previous black/white toggle still open correctly (migrated automatically to the equivalent colour).
  Version 2.4.2 (2026): Fixed the bar/tick text going out of sync at different Layout Designer zoom levels (looked "unstable"/oversized when zoomed out, unlike native items such as Legend or Scale Bar). Root cause: tick and label text were drawn with a raw QFont sized via QFont.setPixelSize() on a manually-computed pixel count — a separate code path from the mm-based geometry used for the bar itself, so the two didn't necessarily track the render context's scale (current preview zoom, or export DPI) the same way. All text drawing and text-size measurement in the colorbar item now goes through QgsTextFormat/QgsTextRenderer — the same API QGIS's own native layout items use internally — so text and bar geometry are measured and drawn through the exact same scale-aware path and stay in sync at any zoom level or export resolution.
  Version 2.4.1 (2026): Fixed the drawn bar not actually growing to match Width/Height — 2.4.0's changelog said "the bar now simply fills the size you set" but the bar's thickness (bar_h for horizontal, bar_w for vertical) was still computed as a fixed 55%% fraction of the frame's short side, so typing a bigger Height/Width mostly grew empty frame around the bar rather than the visible colour bar itself. The bar's thickness is now the frame's short side minus the *actual* space the tick marks, tick numbers and axis label need (measured from their real font size/padding in mm/pt, not a percentage of the frame) — so the full amount typed into Width/Height now goes to growing the bar, down to a 2 mm floor.
  Version 2.4.0 (2026): Removed the "Bar thickness" (%%) setting — it duplicated what Width/Height already control and made the drawn bar not match the item's frame; the bar now simply fills the size you set. Fixed a resize-sync bug where typing a new Width/Height could leave the item's selection frame at the new size while the drawn bar/ticks briefly stayed at the old, smaller size — the panel's forced repaint after resizing is now deferred to the next event-loop tick instead of firing in the same step, so it no longer races the frame's own geometry update. Added a "Text color" option (Black/White) for tick numbers and the axis label, for placing the bar over light or dark backgrounds. Simplified the panel: the empty-state view (shown when no colorbar item is selected) is now just a single "+ Add Colorbar" button, and descriptive hint text/tooltips were removed throughout the settings form for a cleaner, more professional look. Added a README.
  Version 2.3.0 (2026): Renamed the plugin from "QRViz Colorbar" to "RasterViz Colorbar" (display name and dock panel title only — the underlying QGIS layout item type and saved-project attribute names are unchanged, so existing layouts/projects made with older versions still open and load correctly). Reordered the dock panel so Position and Size (the native width/height/reference-point section) now sits directly under Orientation instead of at the very top of the panel, above the Colorbar heading — quicker to reach right after picking an orientation. New colorbar items now default to a 120 x 7 mm bar with 10 ticks (previously 80 x 16 mm with 5 ticks); switching Orientation still swaps width/height automatically, so a fresh item lands on 120 mm long x 7 mm thick when horizontal and 7 mm wide x 120 mm tall when vertical. Added plain, direct "Width" and "Height" (mm) fields right under Orientation, wired straight to the item's resize call plus an explicit repaint, for cases where resizing through the native Position and Size section updated the item's outer frame without the drawn bar/ticks resizing to match; these two fields stay in sync with the native section and with dragging the item's handles on the canvas either way. Moved the native Position and Size / Rotation / Item ID / Rendering / Variables block (everything that used to sit right under Orientation) all the way to the bottom of the panel, below a "More" divider, and switched off its Frame and Background groups since the bar already draws its own outline/fill — so the settings people touch on every colorbar (layer, orientation, width/height, end style, ticks, label) no longer need scrolling past a big native block to reach. Item ID, Rendering and Variables have no public QGIS API to hide individually, so they stay in that bottom block rather than disappearing outright.
  Version 2.2.1 (2026): Fixed a crash ("wrapped C/C++ object of type QWidget has been deleted") that hit every time the panel switched between its empty state and an item's form — QScrollArea.setWidget() already deletes the previous widget itself, so the panel was double-deleting it. Also fixed a NameError in the panel's "+ Add Colorbar to layout" button that stopped it creating a new item. Also switched dock cleanup on window close to the official QgsLayoutDesignerInterface.removeDockWidget() call.
  Version 2.2.0 (2026): Moved all settings out of the generic Item Properties tab into a new dedicated "QRViz Colorbar" dock panel, added automatically to every Layout Designer window (right-hand side) so it's easy to find immediately after installing — no more digging through Item Properties or the Panels menu. The panel follows the layout's selection automatically and includes a one-click "+ Add Colorbar to layout" button for when nothing is selected yet. Added a "Rounded corners" toggle with an adjustable corner-radius (mm) for the bar itself, and made Label padding and Tick padding directly adjustable (mm) instead of fixed values — both carried over from the pre-native plugin's Colorbar tab. Explicit Width/Height sizing (via the embedded native Position & Size section), Number of colors, orientation, end style, tick/label styling and everything else from 2.1.0 remain, now all in one place.
  Version 2.1.0 (2026): The Item Properties panel now embeds QGIS's own QgsLayoutItemPropertiesWidget, so Position & Size (explicit width/height, lock aspect ratio, reference point), Rotation, Frame (border), Background (fill), Blend mode and Opacity are all available natively above the colorbar-specific settings — previously these were missing entirely. Added "Number of colors" (2-256 sampled colour patches, for a smoother or more "stepped" look), "Reverse colour order", "Bar thickness" (%% of the item's short side), and "Tick position" (outside/inside the bar). New items now default to a sensible elongated 80x16mm size instead of a square-ish one, and switching Orientation between horizontal/vertical now automatically swaps width/height so the bar doesn't stay a stubby square.
  Version 2.0.0 (2026): Complete rewrite / scope cut. Removed the entire old plugin: the multi-layer raster+vector engine, the Matplotlib-based standalone dialog/canvas, web basemaps, the custom colormap library, RGB composite, north arrow, scale bar, coordinate grid, and PNG/SVG/TIFF/PDF export. What is left, and all this plugin now does, is a single native QgsLayoutItem: a colorbar with a configurable number of ticks. It's added and configured entirely inside QGIS's own Layout Designer (Add Item toolbar + native Item Properties dock) instead of opening a separate window, and it reads its colours/value range live from a linked raster layer's own renderer, updating automatically when that layer's Symbology changes on the canvas. Zero third-party dependencies (previously required Matplotlib).
  Version 1.4.7 and earlier: see previous RasterViz/QRasterVIZ history at the repository above.
