Lutra Consulting had an idea of gradient colored meshes, but they didn’t reach their goal to develop it.
But the question asked by Tammo on Twitter was quite special. Tammo wanted to apply gradients on lines, and data-define the starting and ending color along a certain color ramp.
Here is my result, that I also gave on StackOverflow. It uses a hack based on interpolating points along a line and coloring them based on their position.
How to do this ?
First, set your line to geometry generator to Points
Then, apply this expression to have interpolated points along the line :
generate_series(0, length($geometry), 0.000001), -- here, we add a point every 0.000001 unit (I am in WGS84)
Here is a zoomed-in image of the line :
Finally, just set the filling color according to the position of the point along the line, and along the subsetted color ramp :
ramp_color( -- this function allows you to select one particular color along a color ramp
'Viridis', -- I ❤ Viridis
@geometry_part_num, -- @geometry_part_num is the number of the point along the line (its position)
0, @geometry_part_count, -- @geometry_part_count is the number for points along the line
"start"/10, "end"/10 -- my values are between 0 and 10, so 10/10 gives 1 (the max of the color ramp)
What if you made them meteors ?
Just set the size of each point from a min to a max :
Interestingly, you can see you can execute sophisticated tasks internally with expressions in the field calculator without making any SQLish virtual layers or applying magic python code.
That makes the Field Calculator a powerful and fun-to-use tool
To me, ArrayPlusshould benefit from higher visibility as adding really interesting operators in QGIS. A user had to remain me of its existence. It would be nice if it joined the panoply of Field Calculator functions.