3

enter image description hereI am currently working on a project: Freshwater Vulnerability Assessment of sub-Saharan Africa. I have 5 sets of freshwater vulnerability categories which i have managed to represent on QGIS as five vector layers. I classified each vulnerability category into four different groups: Low, Medium, High & Very high(see image 1)

I intend to merge these layers into a single multicolored layer output(like that shown in image 2) depicting the addition of all vulnerability categories.In the table of content for each layer I have columns such as country name, Area, VR(Vulnerability Rating) and VR1(Vulnerability score).

Basically, what I intend to do is to combine the layers in image 1 to obtain an output like that shown in image 2.

Image 1: Image 1

Image 2: Image 2

  • 1
    Welcome to GIS:SE @Learner! Have a look through this tutorial about styling your layer with multiple colours: Basic Vector Styling – Joseph Apr 28 '17 at 10:07
  • @Joseph: Thank you so much for the response, i would go through the suggested tutorial and give you a feed back as soon as possible. – Learner Apr 29 '17 at 7:38
  • @Joseph! I have included additional information in my question so you could have clear understanding of the results i like to have. I'd be glad to read back from you.Thanks – Learner Apr 30 '17 at 13:17
  • 2
    Image 1 shows only one colour per country, while image 2 is more granulated within every country. From where do you intend to get that additional information? – AndreJ May 1 '17 at 8:57
  • @Joseph:Thank you for your last reply. Another user "Knightsound" suggested that i convert the vector layer to raster and work on the field calculator, he gave a well detailed answer which i hope should get me the desired result. I would give you an update as soon as i am done working on his suggestions.Thanks – Learner May 1 '17 at 10:34
3

Load all the layers you want to merge into QGIS. Head to 'Vector > Data Management Tools > Merge Vector Layers'. Click the '...' and select all the layers you wish to merge. Select a save location for the new merged layer and then run the tool.

EDIT:

Once the new single layer is loaded into QGIS it will be visible in a single default color (picked by QGIS). Right-click on the layer in the layers panel and open the layer properties. Under the style tab set the style of the layer to either 'Categorized', 'Graduated', 'Rule-Based'. In your case choose categorized. Here you can either select a column to style by (your vulnerability categories column in the attribute table), or even input an expression. Hit the classify button and the style will be loaded for you to play around with the colors of each category. Once all done you'll will end up with a merged single layer, styled with multiple colors of the vulnerability category's.

EDIT:

With the new edited question I believe there are three ways to accomplish this.

Method 1: Rasterize each of those 5 vector layers, using the vulnerability score (VR1 column) as the cell value. I'm assuming the score ranges from 0-6 (NA-Very high respectively). If not, ensure all your vector layers are using the same quantifiable scoring method. Then use 'Raster > Conversion > Rasterize'. For each layer set the attribute field as VR1 and set the raster resolution the same for all the layers. I've not done any work around Africa so not sure on an appropriate resolution (your pics tell me its about 7000km tall and wide so maybe a 5km or 10km resolution could be appropriate, but I honestly don't know). Once all layers are rasterized use the Raster Calculator and add them all together. This will add each cell value together and the final product being a single raster identifying total vulnerability. Once that's complete open up the layer properties and style using pseudo-color and play around with the colors and ranges. You might have a black box around the whole of Africa, but you can either set that particular value (if its nodata or something else) to a transparent or white color for it disappear.

This method will allow you to create a map similar to your image 2 but looking at image 1 your data won't come out like at because your vector layers follow the countries shapes. So method two could be more appropriate.

Method Two: Just like in method one, make sure the VR1 column is a numerical value. Essentially what you're trying to do is to get all the VR1 columns from the five layers into a single layer. This can be done using 'Vector > Data Management Tools > Join attributes by location'. Choose one layer to be your "Target" and then repeatedly run this tool to add the other 4 layers to that first one. You should end up with the attribute table with 5 VR1 columns (probably renamed to VR1_1, VR1_2, VR1_3,...). Open the field calculator and create a new column called Total_VR. Set the field type to integer (or decimal depending on the values your using) and set the field length to be large enough to accept the total value. Then in the expression add all the joined fields together:

VR1 + VR1_1 + VR1_2 + ...

Run the field calculator and you will have a new field with the total vulnerability which you can now style in the method explained in the first edit of my answer.

Method 2b: Something that could be a little faster than 'Join attribute by location' would be to just join the layers together. Again select a primary layer and open up the layer properties. Select the 'Joins' tab and add a join using the country name, select the fields you want to join (namely VR1) and possibly choose a better prefix if you wish. Once all the layers are joined just use the field calculator and style as explained above.

  • @Knightsound:thank you for the response, i tried your suggestion already but the output map i got was a single colored output map not multicolored. – Learner Apr 29 '17 at 7:36
  • ! I appreciate your response, i tried your suggestion already but i got an single colored map not multicolored output. – Learner Apr 29 '17 at 7:44
  • see answer edit – Knightshound Apr 29 '17 at 18:33
  • @Knightsound: I have included additional information to my question so you could have a clear understanding of what i desire. I'd be glad to read back from you.Thanks – Learner Apr 30 '17 at 13:18
  • @Knightsound: Thank you so much for this detailed answer. I think your answer would get me the desired result. I would go ahead to try your suggestions and would give you an update as soon as possible.Thanks once again. – Learner May 1 '17 at 10:30

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.