[Qgis-user] Atlas: Filter Empty Pages
Albin Blaschka
albin.blaschka at standortsanalyse.net
Tue Mar 22 07:58:31 PDT 2016
Hello!
So, finally, I was successful: The idea with the virtual layer made it
simple, as the point data is a postgis layer anyway, after storing the
grid in the database, I created a view, where I have my grid and the
count of points per cell, which I use for the creation of the atlas.
Brings other advantages as well... (...wondering why I had this idea not
earlier...)
The only caveat was that QGIS did not want to load the view as layer
directly - It said, the layer is not valid. But after doing a "select *
from myview" in the DB-Manager and adding the result as layer, it
worked. Will look into it later...
(Postgres 9.4.6, PostGIS 2.1, pretty standard Ubuntu server - QGIS 2.14
on Win7 - maybe somebody has an idea on that, too?)
Thank you all for your help and specially Andreas!
best regards,
Albin
Am 21.03.2016 um 17:00 schrieb Andreas Neumann:
> 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
>
> _______________________________________________
> 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
--
| Dr.rer.nat. Albin Blaschka
| Etrichstrasse 26, A-5020 Salzburg
| * www.standortsanalyse.net *
| * www.researchgate.net/profile/Albin_Blaschka *
| - It's hard to live in the mountains, hard but not hopeless!
More information about the Qgis-user
mailing list