2

I have a Shapefile imported into a QGIS project as layer. And I have created a Style for that layer using a Column from the attribute table. To name it I have grouped several landuse-classes to a group (for example: crop, corn etc. would be grouped to arable-field) to give them a single color in the main window. The names for the landuse classes are in the column named "landUse" in the table.

What I want to do is export to a Raster file (ESRI ASCII Raster including a raster attribute table preferably) but using my grouped classes instead of the normal landUse field in the attribute table as cell info.

When I click on the "vector to raster" menu item in the "raster" menu I can only choose a column from the attribute table.

One of my ideas would be creating a column in the attribute table and giving it a value depending on the value in the column "landUse" and then use this column to rasterize. How do I do that and would that even work or are there other ways?

I am not experienced in GIS. I've tried if a few examples/tutorials similar to my problem to see if they could be applied, but yet nothing works.

2

I've finally solved it. Here is how I did it.

I have used the plugin "QuickMultiAttributeEdit" for it. To install it you simply click on "Plugins" > "manage and add plugins" > "get more" and search for it. Once found click "install plugin".

Then select the layer, open the attribute table, toggle the edit pencil (Ctrl + E) and search by expression (Ctrl + F). There I've searched my column "LandUse" for the search terms and clicked ok (example query: "LandUse" IS ('crop') OR "LandUse" IS ('corn')). Now the attribute table only shows the elements selected by the query, hit Ctrl + A to select them all. You can close the attribute table.

Then go to the menu point "plugins" again. Now go to the new menu point "QuickMultiAttributeEdit". If you click on it a dialog opens. You can select a column from the drop-down menu and set a value for the column for all selected features. To verify if features are selected at all the dialog gives you the number of selected features at the top. Set your value and click ok.

When finished export the vector layer by clicking on the menu "raster" > "conversion" > "vector to raster" and set your preferred values like output file tile size etc.

1

Your Idea might work. To create the column do the following:

  • right click on raster -> open attribute table
  • press the toggle editing pencil (Ctrl + E)
  • add column (Ctrl + W)
  • open field calculator and do the transformation you have in mind by selecting the column you want to refer from via "Fields and Values" in the function list

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.