BC Consulting

Home

   Colour Scale Bar for One-Band Rasters
V0.12.0 - 14 May 2016

This QGIS plugin creates a colour scale bar image file (png) for a coloured 1-band raster. Also works for QGIS native colour schemes thanks to Thomas Wahlmüller. Use the created colour scale bar as legend in print composer.

Distributed under the GPL licence
 

This plugin works on QGIS version 2.x, and is backward compatible with .qml's
generated with QGIS versions 1.x.
 

Once installed the bccscbar plugin can be found in the 'Raster/Raster Colours' menu.


Main window

--- How to use this app ---

  1. Select a QGIS .qml file containing a saved colour palette OR select a colour palette file (as generated by '1-band raster colour table' OR use the currently selected one-band raster layer from the Layers panel (by selecting the "Use current raster" button).
    The colour palette can be of type: DISCRETE, INTERPOLATED or EXACT.  
  2. Fill in the relevant info:
    At minimum you have to define the aspect of the final colour scale bar: either vertical or horizontal.  
  3. From V0.4.0, you can click on the 'Sel out dir...' button to select an output folder to save the colour scale bar image file to. By default, the image is saved in the same folder as the palette file. Take care that when "Use current raster" is selected, the default folder for the saved image of the colour scale bar is your system temporary folder.  
  4. Click 'Create' to create the colour scale bar image file. The file is located in the same folder as the input file.  
  5. Open your favorite image viewer and point it to the file returned by the plugin.  
  6. Tweak the parameters and run again until the time you are satisfied with your colour scale bar.  
  7. Use the created colour scale bar as legend in print composer.

Guided tour:
 
Main window

On completion, the plugin returns the name of the created colour scale bar:

name of the created colour scale bar

NOTES


Examples:

A vertical scale bar:
Example: vertical scale bar

Parameters:

  Title              = SRTM
  Units              = m [AMSL]		  
 
  Enforce   decimals = False
  Number of decimals = N/A
 
  Font size          = 10
 
  Automatic tick     = True
    number of Ticks  = N/A
 
  box Width          = 50
  box Height         = 2
 
  Annotate Extrema   = False
  minimum value      = N/A

 
A horizontal scale bar (click for full scale version):

Example: horizontal scale bar

Parameters:

  Title                = SRTM
  Units                = m [AMSL]
 
  Enforce decimals     = True
    Number of decimals = 1
 
  Font size            = 10
 
  Automatic tick       = True
    number of Ticks    = N/A

  box Width            = 5
  box Height           = 20
 
  Annotate Extrema     = False
  minimum value        = N/A

Return to BC-Consulting plugins page.

Please report any bug/problem/wish at the issues tracker.


History

  • 0.12.0: Fixed: An empty title creates an image cut at the top (reported 2015/12/19).
  • 0.11.0: Remove temporary file(s) when not needed anymore.
                Plugin no longer available from the BC-Consulting repository.
  • 0.10.0: Add some logic on selection/deselection of current raster.
                Tweak ui for beter rendering on different os'es.
                Upload the plugin to the QGIS official repository.
  • 0.9.0: Add an option to use the colour ramp of the selected one-band raster instead of having to select a file.
  • 0.8.0: Fix problem where UI was irresponsive (nothing happened when a button was clicked).
  • 0.7.0: Recompile the UI and add internationalisation in the hope that reported problem is fixed.
  • 0.6.0: Compatibility with QGIS version 2.x
                 Can read .qml files from both QGIS versions 2.x and 1.x
  • 0.5.1: Contribution from Thomas Wahlmüller.
        A summary of the changes:
        discrete styles
        ==========
        same as before, no code changed
        only function name renamed, to better distingunish between the
        functions of other annotations
       
        interpolated
        ========
        interpolation is done in "cdlgSCBR.py"
        annotion is different to discrete (at least 2 ticks at minimum and
        maximum, more ticks are spread equaly)
       
        exact
        ====
        annotation is in the middle of the color, also the height/width of
        the bar is set according to annotation
        a border is drawn around every element
        horizontal bar: minimum box width is maximum annotation length
        vertical bar: minimum box height is annotation height
    Thanks Thomas!
  • 0.4.1: Title font is now linked to the selected label font.
  • 0.4.0: Add the 'Select output folder' button. Remember the last folder used for output and the last folder used for palette selection.
  • 0.3.1: Correct visual interface glitches on Ubuntu.
  • 0.3.0: Changed button text from (*.tbl) to (*.txt) and removed 'pressed' signal trapping.
  • 0.2.0: Changed deprecated call to current call in plugin initialisation.
  • 0.1.0: Correct a bug preventing plugin removal from the plugin menu.
  • 0.0.1: Original published.