1

This question already has an answer here:

I have combined different layers (vector) in a merged layer. All layers had one specific land-use type, so now the new layer has fields called 'tree', 'paved', 'building', 'water' and 'plants'. All these fields either have value 1 or 0. (1 for when this feature has the specific land use and 0 if it doesn't). This means that all features only have one '1' (either in tree, paved, building, water or plants). The other of those fields will then just have 0.

Now I want to add those fields to a new field, so that this field has the type of land cover for each feature, (combine type of land cover into one field basically).

How do I do this?

marked as duplicate by Simbamangu, whyzar, Andre Silva, xunilk, nmtoken Apr 17 '18 at 18:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

Assuming you want a new layer of type string, you can use an expression similar to the following:

CASE
  WHEN "tree" = 1 THEN 'tree'
  WHEN "paved" = 1 THEN 'paved'
  WHEN "building" = 1 THEN 'building'
  WHEN "water" = 1 THEN 'water'
  WHEN "plants" = 1 THEN 'plants'
  ELSE 'unknown'
END
  • Thank you! This helped. I think, however, that i'm facing a bigger overlapping problem. I have this map with those different kinds of land cover as earlier outlined (I have them combined in one shapefile, and also as seperatre shapefiles). I want to overlay a 50 by 50 meter grid of the cells get assigned the landcover that is most prominant. Say 60% is paved and 40% is low plants in a cell, then I want this cell to be 'paved'. How do I do this? Should I first make a raster file and apply zonal statistics? Should I use separate layers? Or use the combined shapefile? Hope you can help me! – Demi Vonk Apr 17 '18 at 16:58
  • As you suggest, zonal statistics would probably be the best way to go in my opinion (with the land cover as a raster). It should be also possible to work directly on vector layers (this post might help : Percentage of polygon in one shapefile within polygon of another). I suggest you to post a new question with all the details you mentioned (and maybe a screenshot or 2) since this quite changes the scope of the question ;) – ArMoraer Apr 17 '18 at 18:33

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