Coloring only half raster polygon in QGIS?

I'm wondering whether it's possible to fill only half of a polygon with a color so I can add another layer in which I color the other half and double the amount of information presented.

For example:

For a certain area I have 2 datasets. One with plant species seen this year and one with plant species seen 10 years ago. Adding a grid layer and doing a unique point count vector analysis will give me the amount of species per grid square (from this year, 10 years ago and by subtracting I can see whether the amount increased or decreased).

Now to present this data: Ideally I want to duplicate the layer. In one layer I want to color only the lower-left diagonal half of each polygon, where I present the data from last year. In the other layer I want to fill the top-right diagonal half with a different color, representing the change over 10 years.

A bit like this My grid squares are 100 by 100 meters. I tried to fill the polygons with only diagonal lines setting the line thickness to half the square as well as the distance between the lines, but that became messy.

• What do you mean by rasterpolygon? – csk Nov 29 '16 at 17:14
• Well, when I create a raster gid (vector, research tools) I can choose the output file to be either a line shape or a polygonshape. For further calculations I need them to be polygons. So I get a rastergrid (I assume it's the same in English, but I'm using the dutch version of QGIS) that consist of many square polygons. In my head I call them rasterpolygons. Since you had to ask I assume my poor definition made many people sad :). – Macgeizer Dec 1 '16 at 20:46

If you created the grid using the Grid tool from the processing toolbox, it has the X and Y values of the grid stored as attributes:

• left
• top
• right
• bottom

Use these attributes to create the corner coordinates. Use the corner coordinates in a Geometry Generated style to create triangular geometries.

Each grid square has corner coordinates like this: Use the make_point function to construct the point geometries of the grid square corners in the expression builder. Remember to combine the coordinate in the order (X, Y).

• left-top corner point: make_point("left", "top")
• right-top corner point: make_point("right", "top")
• left-bottom corner point: make_point("left", "bottom")
• right-bottom corner point: make_point("right", "bottom")

Use the make_line function to combine the corner points clockwise to create the boundary of each triangle. Note that the line must start and end with the same point in order to make a closed polygon.

Use the make_polygon function to convert the line into a polygon.

For the bottom-left triangle, combine the points in this order: left-top, right-bottom, left-bottom, left-top make_polygon( make_line( make_point("left", "top"), make_point("right", "bottom"), make_point("left", "bottom"), make_point("left", "top")))

For the top-right triangle, combine the points in this order: left-top, right-top, right-bottom, left-top make_polygon( make_line( make_point("left", "top"), make_point("right", "top"), make_point("right", "bottom"), make_point("left", "top"))) Tips:

• Instead of using two geometry generated triangles, you can actually use one "simple fill" style and one triangle style. Put the triangle style layer on top, and it will cover up half of the "simple fill."
• Choose your colors carefully. As you can see in my example using the default colors, some color combinations will appear to vibrate on the screen.

To convert a geometry-generated symbol into a separate layer, use the same expression from the geometry generator in the Geometry by expression tool. 