I have a shapefile with 100k points. I want to create an atlas that would only show set of points having the same specific attribute.

3572;"POINT(1.79008147341714 5.93)";"alz_02_2";"Céramique"
3573;"POINT(27.1729542533557 5.99)";"alz_02_3";"Grès"
3686;"POINT(27.1356011546138 5.91)";"alz_02_3";"Céramique"
2264;"POINT(7.64830426499203 6.2)";"alz_01_0";"Lithique"
2264;"POINT(2.35880324738061 6.2)";"alz_01_1";"Lithique"
3574;"POINT(28.1625165379164 5.97)";"alz_02_3";"Céramique"
3573;"POINT(0.609316406683922 5.99)";"alz_02_2";"Grès"
3575;"POINT(28.4974037106703 5.93)";"alz_02_3";"Céramique"
3686;"POINT(3.07935785287035 5.91)";"alz_02_2";"Céramique"
2299;"POINT(2.02291014945037 6.05)";"alz_01_1";"Lithique"
2302;"POINT(7.6597310840181 6.07)";"alz_01_0";"Lithique"
2299;"POINT(7.21508858373733 6.05)";"alz_01_0";"Lithique"
2302;"POINT(2.50870130550044 6.07)";"alz_01_1";"Lithique"
2300;"POINT(2.19214124238729 6.04)";"alz_01_1";"Lithique"
3572;"POINT(27.5621763726535 5.93)";"alz_02_3";"Céramique"
2301;"POINT(2.3191856638636 6.04)";"alz_01_1";"Lithique"
2300;"POINT(7.29670253603475 6.04)";"alz_01_0";"Lithique"
2301;"POINT(7.60792547014961 6.04)";"alz_01_0";"Lithique"
3575;"POINT(0.998974763657425 5.93)";"alz_02_2";"Céramique"
3574;"POINT(0 5.97)";"alz_02_2";"Céramique"

So in an atlas, the purpose is to display only points depending on id_coupe, so to speak one map with only Alz_01_0 points, one with alz_01_0 points, etc. but I have to keep all the lines (no aggregate). In this way I can use symbology with symb attribute.

I see things like this.

  • Apply a symbology using symb attribute to all points. "Céramique" -> red point, "Lithique" -> blue point,...
  • Find a way to automatically create maps with all points having id_coupe = 'alz_01_0' for the first one, with id_coupe = 'alz_01_1' for the second one, all points with id_coupe = 'alz_02_1' for the third one, up to the last id_coupe so to speak the 299th one.
  • Of course the symbology has to be kept for all maps.

Obviously, this seems to be a challenge unless being a python Jedi (?) I am not :/

  • Possible duplicate of How to filter features in other layers of a QGIS Atlas? – Gabriel Jun 26 '18 at 13:21
  • @GabrielC. It is not realy a duplicate because the question is to make an atlas based on values and not on geometries – PieterB Jun 26 '18 at 13:26
  • True. I looked more at how the answers in both questions use the same technique to show/hide the features and ignored how the atlas pages were generated. – Gabriel Jun 26 '18 at 13:32
  • what do you mean by 'I have to keep all the lines'? – PieterB Jun 27 '18 at 7:33
  • 1
    You have to combine both answers. Mine for creating automaticly the maps based on attr3. And @cm1 to apply the style to change when the subject of the atlas (=attr3) changes – PieterB Jun 28 '18 at 6:47

Just to add on to PieterB's answer here, you can create a virtual layer

'Layer'->'Add Layer'->'Add/Edit Virtual Layer'

Give it a query that will aggregate the geometries by 'att3'.

enter image description here

Then in the Layout set the coverage layer to this new Virtual Layer like so:

enter image description here

Make sure layout extents are controlled by Atlas.

enter image description here

edit: enter image description here

  • I can't get anything matching between atlas and symbology based on rule, even when using attribute() function. Still working on it – Leehan Jun 26 '18 at 14:32
  • In Layout, under 'Atlas'->'Atlas Settings'->''Filter with' try setting it to something like "att3"='A1' OR "att3"='A2' OR "att3"='A3'...etc. Also make sure to toggle on 'Generate an atlas' checkbox...also on 'Layout'->'Item Properties' tab for map make sure "Controlled by atlas" checkbox is toggled on. – cm1 Jun 26 '18 at 15:05
  • Thanks a lot. I did a little bit of the same thing with postgis. But 2 things : first I have 299 distinct values in att3 ! i.e. att3 =(A1, A2,...A299) ; and above all, I have to keep all the lines from each att3 because I need their attributes to make a symbology. So as conclusion, I try to create an atlas based on 2 fields : one for symbology and one for the atlas (att3), and I can't aggregate this last one. I will edit my first message with a sample of my data. I hope I am clear. – Leehan Jun 27 '18 at 6:45
  • Sounds like a daunting challenge with so many different combinations. You might try playing around with how the feature is filtered in the atlas (concatenating the id and symbology) in combination with some rule-based symbology. I added another screenshot for ideas. – cm1 Jun 27 '18 at 16:15
  • 1
    You have to combine both answers. Mine for creating automaticly the maps based on attr3. And @cm1 to apply the style to change when the subject of the atlas (=attr3) changes – PieterB Jun 28 '18 at 6:48

You have to do 2 things:

  • create a virtual_layer based on the unique values in "attr3" that will serve as coverage layer
  • style your layer in that way so it shows only the features that are filtered in the printcomposer

1/ create coverage layer based on unique values: layer > add layer > add virtual layer

load your layer and as query add select distinct attr3 from your_layer_name

2/ set 'virtual layer' as coverage layer in the printcomposer and select "attr3" as Page name

3/ make a rule-based style "attr3"= @atlas_pagename

now activate the atlasfunction and you'll see only the filtered features

  • yep, but in this case, I have to write each att3 = A1, then = A2, then =A3.., Or I have 299 distinct values in att3... – Leehan Jun 26 '18 at 12:43
  • @Leehan and you just want 1 map with all filtered points on it? – PieterB Jun 26 '18 at 12:46
  • This answer should work but how do you setup your atlas? How do you define the pages? Assuming you want as many pages as you have values of "att3", just set the atlas config Page Name to your att3 field and then Filter with using "att3" = @atlas_pagename. – Gabriel Jun 26 '18 at 13:01
  • 1 map with all points having att3 = A1, 1 map with all points having att3 = A2, and so on – Leehan Jun 26 '18 at 13:01

I made some progress thanks to all of you :)

  • I did not create a specific coverage layer but used my points layer as coverage.
  • Then I have modified the rules like this:

rules to filter entities depending on (attr3 =) EntiteArch)

@atlas_pagename = "id_coupe"||'_'||'Lithique' and "EntiteArch" = 'Lithique'
  • In the atlas, "filter with" has to be unclicked

And now It works: I can id_coupe by id_coupe have each EntiteArch separatly.

Now The problem is: There are as many maps as rows i.e. one by entity i.e. by point!

enter image description here

But it will be my next question ;)

  • 1
    as I said, you have to combine both answers: style and coveraglayer! – PieterB Jun 28 '18 at 11:02
  • @PieterB understand, I did it your way and it it the first time I am using a coverage layer without geometry ; astonishing by the way. – Leehan Jun 29 '18 at 8:01

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.