[Qgis-user] Atlas: Filter Empty Pages

Andreas Neumann a.neumann at carto.net
Mon Mar 21 09:00:01 PDT 2016


hm - actually, I was wrong.

It is not so easy to filter dynamically - as $geometry equals 
@atlas_geometry and you don't have a relation with the points.

My next try would be to use a "Virtual Layer" and add a spatial 
relationship between your atlas coverage layer (the grid) and a column 
containing the count of points within the atlas feature.

See 
https://www.qgis.org/en/site/forusers/visualchangelog214/index.html#feature-virtual-layers

You need QGIS 2.14 to use the virtual layers.

You can add a virtual column to the atlas coverage layer that uses a 
spatial relation, group by and count. If the count is zero you can 
filter that coverage feature away.

This should hopefully work. Let us know if you are stuck.

Andreas

On 21.03.2016 16:41, Andreas Neumann wrote:
> Hi Albin,
>
> You can do this dynamically. The Atlas filter also accepts geometry 
> relationship functions. Have a look at the QGIS expression editor.
>
> You can try with the intersects / within / overlaps tests and test 
> $geometry against @atlas_geometry.
>
> Your filter could look like:
>
> within( $geometry,  @atlas_geometry )
>
> Can you please report back if that works?
>
> Greetings,
> Andreas
>
>
>
> On 21.03.2016 14:47, Albin Blaschka wrote:
>> Am 21.03.2016 um 14:20 schrieb Bernd Vogelgesang:
>>> sounds maybe to easy, but why don't you just make a spatial query on 
>>> your coverage grid to select and save those elements which do have 
>>> points inside (Grid Layer Contains Points Layer e.g.) and then use 
>>> that new coverage layer to produce your Atlas?
>>>
>>> Or do you search for a more clever approach?
>>>
>>> Cheers
>>> Bernd
>>
>> Hello Bernd, Joris & List!
>>
>> Ah, yes - that would be a possibility, which I did not think of - 
>> Thank you both!
>> ...but in general I was on the quest for a "more clever" meaning here 
>> "dynamic" approach, I have to admit: So, the aim would be in future, 
>> just opening the project, printing the atlas without further 
>> intervention and getting an "up-to-date" atlas...
>> But in the meanwhile, it should be ok with the "manual" approach.
>>
>> Thanks and greetings!
>> Albin
>>
>>> Am 21.03.2016, 13:53 Uhr, schrieb Albin Blaschka 
>>> <albin.blaschka at standortsanalyse.net>:
>>> Hello List!
>>>
>>> I am starting to use the Atlas feature for the first time and had 
>>> the following problem:
>>> I have a coverage-layer (a vector grid) and a point layer 
>>> (collection sites). At the moment, there are grid cells in which no 
>>> site (point) is located.
>>> My problem is: I would like to filter those "empty" 
>>> atlas-elements/pages out. In other words, if the atlas-page contains 
>>> no element of the point layer, it should not get printed/produced.
>>> I tried myself and failed, I googled and failed...
>>>
>>> Is this possible and if yes, how?
>>>
>>> Thanks in advance,
>>> Albin
>>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user




More information about the Qgis-user mailing list