5

I have a traffic signals layer that has 500 categories in its style config (one different svg for each signal type):

enter image description here

The problem is that as I add new categories QGIS Map turns slower and slower. After having all the categories added I can pan and zoom ok but from time to time (every 20 seconds aprox.) it gets stuck thinking for about 15 seconds...

If I delete categories and leave only 200 categories it also gets stuck but for 6-7 seconds...looks like it is something quite proportional; The more categories the slower the map.

I also tried distributing those 500 categories between 5 layers but the performance is very similar...

What is the cause of the problem? Is there any workaround/solution?

1
  • 1
    can you share test data of the project so that we can replicate? Sep 6, 2016 at 16:24

3 Answers 3

4

I think the SVG is the issue - I find SVG symbology can be slower than the other types.

Since QGIS 2.8 it's been possible to have more than one style per layer. So you can save two or more styles per layer, e.g.

  • your original style, with SVGs
  • add a simplified style, which uses plain or no markers

You can then switch to the plain style when you need speed (e.g to pan around the map) and switch back to the SVG style for final rendering.

In prior versions, you needed to duplicate your layer to style it differently, and toggle between the two...

You could also copy your existing style, and keep only those markers related to a theme (e.g. traffic lights, directions, cycling etc). This might speed things up but still let you see (some of) the markers at any time.

3
  • It turns out that switching the layer off, does not fix the problem: although the layer is off, the map keeps getting stuck. If I add a new simplified style in that layer the problem solves,on the other hand (while that simplified style is activated). I don't know exactly what kind of processing is QGIS doing to keep being slow even when the layer is off..
    – Egidi
    Sep 7, 2016 at 12:44
  • Is there any update on this? Large-scale projects turn extremely cumbersome and crash really often. Since no svg is involved I don´t think it has to to with it. As mentioned by others, slowness does not decrease by turning layers off. Seems like a bug to me
    – hilpers
    Dec 19, 2016 at 13:31
  • I'd suggest raising an issue. If the XML for a project files gets really large there could be problems keeping it all in memory.
    – Steven Kay
    Dec 19, 2016 at 22:09
2

Are you creating this layer, or just viewing it?

If you're just viewing it, the simplest workaround is to turn off the traffic signals layer most of the time, and only turn it on when you need it.

You could also duplicate the layer, and change symbology of the the duplicate to something simple. Simple, uncategorized points will load much more quickly than 500 different custom symbols. Use the simple version most of the time, and switch it out for the fancy one when you want to print the map.

2
  • For your first advice, it QGIS turns slow even if the layer is off. Your second advice sounds coherent, but I guess it will be slow too (as it is slow even with the layer off); I'll try it.
    – Egidi
    Sep 6, 2016 at 19:42
  • Given the new information that QGIS is slow even when the layer is turned off, I wouldn't expect my earlier suggestions to be helpful. Steven Kay's advice to add more than one style to the same layer sounds much more useful.
    – csk
    Sep 7, 2016 at 19:41
1

Have you turned on multi-threaded rendering?

Settings>Options...>Rendering>Tick: Render layers in parallel using many CPU cores.

This will not make it go any quicker, but will allow for all the other layers to load quickly. So you only have to wait if you want to see the one with a huge amount of categories.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.