Am 23.03.2016 um 07:27 schrieb Karl-Magnus Jönsson:
Hi!
QGIS likes to have something unique. Try to add something like this in your 
select statement. This is a snippet from a view I made that works:

        SELECT row_number() OVER (ORDER BY o.id, s.id) AS uid,
         s.id,
        ...

Row_number creates a counter and then you have to decide the order in "OVER()". 
o.id and s.id is just what I use to sort on in my tables.

Hi!
Thank you for your suggestion, but I *do have* a primary key, which I selected in the dialogue for loading it as a postgis layer... It is not only QGIS, which likes something unique, every table in a database likes it, too ;-)
With the workaround in the Database Manager, everything is ok...

best regards,
Albin


-----Ursprungligt meddelande-----
Från: Qgis-user [mailto:qgis-user-boun...@lists.osgeo.org] För Albin Blaschka
Skickat: den 22 mars 2016 15:59
Till: qgis-user@lists.osgeo.org
Ämne: Re: [Qgis-user] Atlas: Filter Empty Pages

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#fe
ature-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.blasc...@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@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@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!

_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to