2

I have a vector layer of a map with a number of regions. I have coloured those regions using a gradient blue colour. I would like to create a colour scale bar for this map. I downloaded the Colour Scale Bar for One-Band Raster plugin from this website: http://www.bc-consult.com/free/bccscbar.html.

I created a .qml file by going into Styles and clicking on Save Styles - QGIS Layer Style File, but when I try to open this file in the plugin, it gives me an error saying "Error Wrong Input File (must be a colour table .txt or a custom QML file!).

Maybe the error is to do with the fact that I made the .qml file using a vector map and not a raster map. Could someone please help me in this. Is there a way to make the colour table in .txt from Styles (in a vector map) and then opening that file in this plugin to make a Colour Scale bar.

1

We can abuse the use of qml files.

  1. Style your vector layer using Graduated symbol colors (which you have done so already). Remember (a) how many classes you have and (b) range of each values.
  2. Open a (any) raster layer. This is just a dummy, so any raster file (like DEM) would be good.
  3. Style this raster layer using Blues color scheme, applying Mode: Equal interval and Classes: the number of classes you need (1.a). Then Save this style as a .qml file.
  4. Open this .qml file by a text editor. Find a section starts with < colorrampshader ... >, there you have several < item alpha="xxx" value="xxx" label="xxx" color="#xxxxxx"/ > entries.
  5. Edit value="xxx" and label="xxx" and give the information you've got from vector styling ((1.a) and (1.b)). Then Save (overwrite) the qml file.
  6. Run One-Band Raster plugin on this modified qml.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.