1

I have the following problem. I want to link a value from an Excel file to a raster layer. Uploading the Excel file and linking to other vector layers via properties -> linking is no problem.

However, the ID values ​​from the Excel file should be linked to the same ID values ​​from the grid layer in order to have a region number in the grid, depending on the ID values. Is there a simple tool for this or is it only possible via detours?

3
  • 1
    Es tut mir leid, aber hier muss mann English schreiben - at least if you want to have some answers to your question. (I speak relatively good German, but I have no idea what "verknüpfen" means here) Commented Feb 18, 2020 at 13:03
  • 2
    In order to make it easier for other users to understand and answer your questions, and to research both later on, please use any translation service in order to convert your text to English, thank you.
    – Erik
    Commented Feb 18, 2020 at 13:05
  • 1
    Perhaps a duplicate? I have edited with what was translate from google. gis.stackexchange.com/questions/113539/…
    – GISHuman
    Commented Feb 18, 2020 at 13:11

2 Answers 2

1

Linking an attribute table (such as an Excel file) to a raster is possible, but only if the raster is in integer form.

With integer rasters, the values for each cell are limited to, well, integers. This is in contrast to floating-point rasters, wherein cell values are represented with decimal numbers.

Since integer raster values are constrained to just integers, it becomes possible for such rasters to be designed with an internal attribute table (known as a raster VAT or a RAT, Raster Attribute Table). Such tables look and act just like the attribute tables found in vector data, including the presence of unique ID values. This means that external tables, such as your Excel file, can be linked to the raster. No need to polygonize your raster!

Unfortunately, QGIS does not yet support integer rasters*. However, there is a crowdfunding effort underway at Kartoza to implement integer raster support for QGIS. Send 'em a pledge!

See this link for more info on the difference between integer and floating-point rasters.

*To be specific, QGIS will load and display integers rasters, but the the raster's internal VAT will not be exposed.

0

If I'm understanding the translation right, you have a raster layer whose values represent different categories. You want to link to additional attributes for each category in an Excel layer.

If this is it, one process is as follows:

  1. Save the Excel attribute table as a CSV file.

  2. Load the CSV file as a layer with no geometry using Add layer / Add delimited text layer

  3. Polygonize (under Raster / Conversion) your raster layer into a vector polygon layer. The raster values will be put into an attribute of this vector polygon layer, by default called DN but this can be changed.

  4. Open the layer properties of the vector polygon layer, and make a join to the CSV layer from step 2, linking DN from 3 to the category attribute in the CSV.

  5. You can now access the additional attributes originally from the Excel file for each polygon.

Note different settings on 4- vs 8- connectedness, and whether or not you dissolve, will effect exactly how the regions sharing the same raster value are grouped. You can also post-process the vector layer to split or join attributes, or measure their area, etc.

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.