6

I'm struggling to invert the direction of the gradient inside a buffer. I've been playing around with the rotation inside the symbology menu but it's leading me nowhere. enter image description here

Basically, I need the gradient to go from shore to the ocean. The shore is materialised by the brownish line. What I've done so far is to compute the symbology menu like this: enter image description here

But the gradient always start from the centre to the outskirts of the buffer. Is there a way to have it homogeneously go from the "top" of the buffer (i.e. from the line), to the bottom of the buffer? Best option would be to have the gradient go from dark close to the shore to clearer close to the bottom of the buffer.

2
  • 2
    The rotation colors the whole polygon based on its bounding box, not along it's middle axis. – Erik May 15 '20 at 9:00
  • improved my answer – Babel May 20 '20 at 13:32
6

Using the geometry generator based on a line I was able to create the following:

enter image description here

The idea is: Create a transparent buffer (10 %) to one side of the line (hopefully all you lines have been drawn in the same direction). This is done by single_sided_buffer($geometry,50,25).

$geometry is the line in this case, 50 is the width of the buffer in layer units and 25 is how many segments a quarter-circle should be represented by.

Then I duplicated this symbology-layer and made the copy a bit more narrow (45 m in this case). And so on, until I reached 5 m width. The result has isolines in it, but if you make your steps small enough, they will become nigh invisible.

5

This is a Line-based approach using Array of offset (parallel) lines tool in the QGIS Processing Toolbox > Vector Creation.

(1) Start the tool and set number of features, say 100 lines at 1.0 m (or -1m to make them the right-side) step distance.

enter image description here

(2) The tool will produce Offset lines layer. Set Graduated symbol using the offset value.

enter image description here

(3) The output would be like below. As we are working on lines, benefit of this approach would be seen when you have narrow kinks.

enter image description here

2
  • great way to do it as well, super input thanks – Tim56 May 15 '20 at 9:45
  • Damn, I knew I forgot something. – Erik May 15 '20 at 11:26
5

Updated: to improve my original answer, you can do as follows: create a buffer from your shoreline. This Buffer-polygon must be behind your land-polygon. If you than style the buffer with shapeburst symbol layer type, you just have to select a color ramp and set a distance. That's all, see here:

Shapeburst shore

Original answer:

Have you tried Shapeburst symbol layer type? What you want to achieve is easier to realise with that rendering style. However, even than you have the gradient coming form all lines of the polygon coming... set the last color to transparent and set a fixed distance. To hide the color on the opposite side, consider creating an additional layer on top of it to mask the gradient form the opposite side.

enter image description here

You have in the background your layer for the ocean in a set color. Use the same color as second color in the gradient of your shapeburst on top ot the ocean-layer and use again the same color as 3rd color with 100% transparency. The mask-layer on the top is again in the same color. Together with the mask-layer on top, it could look like this (the thin dotted line is just to indicate the polygon-shape of the mask-layer):

enter image description here

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.