To summarize: I'm having difficulties with creating a heatmap from a large (90021-item) polyline dataset in QGIS 3.10.1.

First, it is worth noting that this question is somewhat similar to Doing heatmap from line data in QGIS? and to Create line heatmap with QGIS. In particular, I have a single polyline (vector) layer containing all 90021 features, each with a few thousand vertices. These lines represent Google Maps-style travel routes, and each one also has an attribute that I'd like to use as a weighting factor in my heatmap.

I initially attempted to follow roughly the procedure described in the third answer to the first question above, which consists of:

  1. Densifying each line (using the native QGIS algorithm for this), so that vertices occur at regular intervals;
  2. Extracting these vertices (again, with the native QGIS algorithm), isolating them from their lines while preserving the weighting attribute; and
  3. Editing the symbology for this vertex layer so that it renders as a heatmap, using the desired attribute as a weight factor.

Unfortunately, the size of my dataset makes this approach infeasible - an earlier dataset, at half the size of my current one, quickly filled my computer's RAM and froze it during this process.

I also tried the approach outlined in the accepted answer to the second question above, using feature blending modes to attain the desired effect. Again, the size of my dataset was problematic. The Addition blending mode, seems to be the best option for heatmap-like output, as it simply adds the RGB components of the pixels to be overlaid. (More layered lines = a lighter color.) However, so many lines overlap that even with the feature color set to 1, 1, 1 (in RGB form), a large portion of the layer becomes white - in effect, there are so many lines overlaid on each other that the RGB values hit their maximum too soon.

Does anyone know how I might be able to proceed? (If it helps, here's the list of QGIS blending modes.)

  • AT what point in the process does it freeze? If you make it through steps 1-2 and freeze on step 3, try using the 'heatmap' algorithm to generate the heatmap as a raster? That way it doesn't have to live-render the heatmap every time you pan zoom the map.
    – csk
    Jan 1 '20 at 21:47
  • @csk With my older, half-size dataset, it would make it about 5% of the way through step 2. Since I chose to output to a new memory layer, with so many features and vertices, it completely filled my computer's RAM.
    – Luke R
    Jan 2 '20 at 18:34
  • @Luke R, - submitting answer because I cannot comment - Did you find an answer to your problem? It seems identical to mine - I too would like to upload a large array of polylines and make heatmaps. Very keen to know the solution!
    – James
    Jun 4 at 7:48
  • @James See my new answer below. Hope it helps!
    – Luke R
    Jun 5 at 22:15

Since this is still unanswered, I'll describe the method I eventually settled on: I edited the layer symbology so that the lines were mostly transparent. That way, when they overlap, the transparency will stack, giving a similar effect to a true heatmap (but in monochrome, of course). The downside is that it will take some experimentation to get the right transparency, which depends on the maximum number of lines that coincide at any point.

(Also, this ignores the weighting constraint that was present in my initial question. Unfortunately, I see no way around this.)

While not a true heatmap, this method served me reasonably well. Until QGIS adds a real heatmap option for polylines, this seems to be the best workaround.


After reviewing the similar questions linked in my original post, I actually have a much better option. Thanks to DMAD Tim for this one!


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.