1

I often have layer metadata like labels for each unique value in a categorical map in a separate file, like in Excel. Is there a way to copy/paste entire columns from Excel into QGIS (and the other way around)?

I have a layer. Let's say a categorical raster layer. I right-click it, 'Properties', 'Symbology', do 'Paletted/Unique values'. Then click 'Classify'. I now have a bunch of non-descriptive, default-generated labels in the 'Label' column. But I already have those labels in Excel.

I want to not have to re-type them like a caveman. So I'm looking for a way to paste what would presumably be (on the clipboard) a newline-delimited list of strings into QGIS.

3
  • Could you elaborate more on your process and needs, as it's formulated it seem that some join or relation could be the answer but it's hard to say
    – J.R
    May 19, 2022 at 14:21
  • I have a layer. Let's say a categorical raster layer. I right-click it, 'Properties', 'Symbology', do 'Paletted/Unique values'. Then click 'Classify'. I now have a bunch of non-descriptive, default-generated labels in the 'Label' column. But I already have those labels in Excel. I want to not have to re-type them like a caveman. So I'm looking for a way to paste what would presumably be (on the clipboard) a newline-delimited list of strings into QGIS.
    – Roel
    May 19, 2022 at 14:29
  • 2
    That more clear, unfortunately I don't have solution for you (my first thought using join would be good for attribute table but definitely not for raster symbology) hopefully somebody else will have a solution for you. As a side note it would be better to add your explanation the question body rather than as a comment
    – J.R
    May 19, 2022 at 15:02

1 Answer 1

2

Your symbology can be loaded by clicking on the three dots next to Delete All button(On the Layer Properties window, Symbology section) option -Load Color Map from File...-. The file must have extension clr as plain text. Inside this file should follow the format:

<Value> <r> <g> <b> <a> <Label>

Example:

0 136 78 87 255 My Label1
1 162 239 95 255 My Label2
2 44 59 192 255 My Label3
2
  • Yeah I know, but then I have to maintain all my metadata in two formats - the original one and this custom QGIS format. I'd much rather just have an easy way to transfer between existing formats. In fact, I miss this in more places; e.g. the 'reclass table' for the Reclassify tool has the same problem. Anyway I figured I'd ask...
    – Roel
    May 19, 2022 at 19:45
  • Is not so custom format, from Excel you can save any file as csv but separated by space or tab instead semicolon, and then change the file extension.
    – Pepe N O
    May 19, 2022 at 19:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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