Monday, 13 February 2017

postgis - How to visualize measure values along linestrings in QGIS?


I have a series of LineStringM geometries. The measure value represents slope (or stream gradient) at each point in the geometry. I love QGIS's robust styling options, but I can't find a way to render each measure value along my linestrings. Ideally, I would have blue for slow gradients, and red for very steep gradients.


To help understand what I'm trying to accomplish, let's suppose we've used Linear Referencing to encode the length of the LinestringM thus far into each point's measure value. At the top, you would have 1.0 and at the bottom, you would have 0.0. I've added an image what what I'm hoping to accomplish below. I made this in Paint.NET, so it's just a mock-up. enter image description here direct link to image



How would you go about accomplishing this in QGIS?



Answer



One option would be to load the line as one layer and the line vertices (could be a view on the line table) as a second layer which can then be labeled. You can use ST_M() to write the measure value to a view attribute.


Stylingwise, we have to deal with the challenge that there is no gradient line style yet ...


But there are polygon gradient fills. So we can buffer the line and style the buffers. It's a bit of an exercise in data-defined styling though:


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...