1

I have a set of 700 points within the footprint of a 16-storey building. The points have a building floor attribute (e.g. "Floor" = 12), and another attribute relevant to my presentation (call it "AttType" = 'A', 'B', 'C'...).

I want to generate a map for each floor which should do two things:

  1. display only the points on that floor
  2. show accurate point counts per AttType in the legend

I have managed to do 1 by creating 16 map composers and naming the map ID "Level 1", "Level 2", etc., then styling the point layer with the rule @map_id = concat('Level ',"Floor") so that only points of the appropriate floor show up.

However, because of this non-exclusive rule-based styling, 2 doesn't work: the feature counts in the legend show [0] for each AttType.


I can think of two workarounds, but neither is satisfactory:

  1. One is to have 16 copies of the point layer, each filtered to a specific floor and named "Level 1 Points", etc., then setting up each map composer with a map ID as I already do ("Level 1"), only with a layer filter using a data-defined override (e.g., concat(@map_id,' Points')|'Other vector layer'|'Background raster')

However, having 16 point layers in the project makes it quite sluggish, and having to update any style changes in one layer across all 16 layers is something I'd really rather avoid.

  1. The other is to manually generate feature counts in text boxes using aggregate() (e.g. aggregate('layer name','count',"AttType","AttType" = 'A' AND "Floor" = 1) and put them in the appropriate place next to each AttType on the legend.

    This is even more time-consuming, but does avoid the problems of the latter workaround.


Is there any other way to solve this issue?

The Map Composer legend seems hard to customise.

My understanding is that I cannot use the Atlas function as the points all fall within the same XY plane (=building footprint).

  • I'm working on a similar problem (although I should be able to use Altas but can't get it to work the way I need yet). One idea I've just has is to aggregate the feature count in a virtual layer and then bring that into composer. Like I say I've not tried it yet, I'm hoping that the output can be controlled by the map ID (or atlas id in my application). – SteveW May 15 '18 at 6:44
  • If you solved your problem, could you please share your solution? – Kadir Şahbaz May 15 '18 at 8:40
  • I'd forgotten all about this post as I haven't worked on this project in a while, but alas, no real solution even with 3.0. – she_weeds May 15 '18 at 9:24

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.