I have reclassed my data so show areas were wind speed is greater than 5m/s and were it is not.

I have converted this raster file to a vector file however it showing as one single colour and not defining between the white and black separated boundaries in the raster file.

I have looked at the style menu and tried to change the colours but nothing seems to work.enter image description here

enter image description here

  • The title is different from the content of the text. Do you want to style your polygon based on their pixel values or do you want to convert raster to polygon? If you want to convert raster to polygon then you need to use polygonize tool. Search for Polygonize tool in the processing toolbox and convert the raster to polygon. – ahmadhanb Mar 1 '19 at 13:16
  • sorry for the poor phrasing I am new to the software. I have already polygonised it from raster to vector, however it shows as one single colour after I have done so. I am now wanting to syle it based on pixel values – Tom Haywood Mar 1 '19 at 13:19
  • I am wanting it to show the same black and white colours as it did before in the raster file which was black for areas below 5/ms and white for areas 5m/s and above – Tom Haywood Mar 1 '19 at 13:22
  • 4
    Please Edit the question in response to requests for clarification. It's not fair to those who would help to need to mine the comments for information. – Vince Mar 1 '19 at 17:47

Assuming your raster cell values are now stored in the vector layer as attributes, all you need to do is style the vector layer.

  1. Select the vector layer in the Layer panel, and open the Layer Styling panel. Choose "Rule-Based" style from the dropdown menu.
  2. Add a new rule based on the attribute table field where the raster cell values are stored. Substitute the actual field name into this expression where it says rastervalue:

    "rastervalue" < 5

    enter image description here

  3. Add a second rule for "rastervalue" > 5

  4. Style the first rule with black fill, and the second rule with white fill. Make the boundaries 'no pen' if you don't want to see an outline around every polygon.

enter image description here

This topic is explained in more detail in the QGIS training manual, Lesson 4.3.5: Rule Based Classification.

  • I have included pictures of each file. when I follow your instructions it highlights different areas in black to what is shown in the raster – Tom Haywood Mar 2 '19 at 12:46
  • @TomHaywood as I can see in your screenshot your rastervalues go from 0 to 0.999. You might want to try with these values. E.g. "rastervalue" <= 0.5 and "rastervalue" > 0.5 or whatever matches your windspeed correctly. – MrXsquared Mar 2 '19 at 14:00

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.