I have a straight line with two vertices, which I'd like to style. I want the style to be a fading line from start to end, so the transparency is gradually increasing from start to the end of the line. I thought I could make it with geometry generator, using some function to locate point along the line, then splitting the line into smaller parts and applying something like color_hsva() with scale_exp() to map the alpha to a distance. Unfortunately, I couldn't find any function to get a line substring or any analogue to the st_line_locate_point() postgis function. Of course I can do this by splitting line in the data, adding a segment number to each part from startpoint, and then style them separately, but it's a bad solution. Any ideas how to do this by qgis styling and without messing with the data?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.