<p dir="ltr">Hello Sergio, </p>
<p dir="ltr">You can use a view,  all you need is to recreate an id with unique values to use as key in qgis.</p>
<p dir="ltr">This will do:</p>
<p dir="ltr">With query as <br>
(SELECT * FROM specie_a UNION ALL SELECT * FROM specie_B UNION ALL SELECT....)<br>
SELECT rownumber() over() as id, query.*<br>
FROM query</p>
<p dir="ltr">Best regards, </p>
<p dir="ltr">Alexandre Neto</p>
<div class="gmail_quote">Em 12/09/2014 21:11, "Sergio Vignali" <<a href="mailto:vignalisergio30@gmail.com">vignalisergio30@gmail.com</a>> escreveu:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks Alexandre,<br><br>now I understood and it work fine! I created an union table as followed your explanation.<br>I try to better explain:<br>I have a table for each species in postgis, I created a table like that:<br><br>CREATE TABLE atlas AS SELECT * FROM specie_a UNION ALL SELECT * FROM specie_B UNION ALL SELECT....<br><br>I created a polygon layer with several polygons but all equal to itself and with a field with the name of the specie<br><br>then the join and the ruled based style as you described and all is fine<br><br>the only pity is I can't use a VIEW created in the same way instead of a TABLE (at least I can't create a primary key) because with a view you don't need to change nothing if you add some entry in the specie tables, what do you think?<br></div><div>You can find two images below:<br><br><a href="https://www.dropbox.com/s/rq5ysd6lcfic5zp/atlas1.png?dl=0" target="_blank">https://www.dropbox.com/s/rq5ysd6lcfic5zp/atlas1.png?dl=0</a><br><a href="https://www.dropbox.com/s/fyd0w2ztiuddvyj/atlas2.png?dl=0" target="_blank">https://www.dropbox.com/s/fyd0w2ztiuddvyj/atlas2.png?dl=0</a><br></div><div><br></div>All the best<br></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-12 17:36 GMT+02:00 Alexandre Neto <span dir="ltr"><<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Sergio,<div><br></div><div>If I understood you well, You have several layer\tables? One per specie? Because that wasn't  the case study presented by John, where all species were in one unique table\layer. If you have several layers, atlas won't be able to iterate over them or turning them on and off for you without the same amount of work that would involve making the species maps one by one.</div><div><br></div><div>Anyway, regarding the basemap, I'm not sure about what you are asking. but you can create the grid yourself.</div><span><font color="#888888"><div><br></div><div>Alexandre Neto</div><div><br></div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 12, 2014 at 1:51 PM, Sergio Vignali <span dir="ltr"><<a href="mailto:vignalisergio30@gmail.com" target="_blank">vignalisergio30@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hi Alexandre,</div><div>many thanks for your explanation! This is the first time I use the atlas generation and I begin to understand how it work. But I have another question, you suppose to have several point layers of species distribution, but all in the same area, so in this case you need to have a basemap good for all the species but you want to change only the points above the basemap. Something like the Atlas of species distribution in which you have a basemap with an utm grid and above a dot only in the square where the specie occurs.</div><div>This is what I'd like to do, I have all the data in a postgis database where I have also several tables with the centroid of the square in which the specie occurs.</div><div>What solution you suggest?</div><div><br></div><div>All the best</div><div><br></div><div>Sergio</div></div><div class="gmail_extra"><div><div><br><div class="gmail_quote">2014-09-03 15:51 GMT+02:00 Alexandre Neto <span dir="ltr"><<a href="mailto:senhor.neto@gmail.com" target="_blank">senhor.neto@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hello all,<div><br></div><div>On Mon, Sep 1, 2014 at 9:52 PM, Nyall Dawson <span dir="ltr"><<a href="mailto:nyall.dawson@gmail.com" target="_blank">nyall.dawson@gmail.com</a>></span> wrote:<span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><p dir="ltr"></p></div><p dir="ltr">I'm 99% certain that what you are after is possible in QGIS 2.5 (the unreleased development version of 2.6). But do you mind posting this question over at <a href="http://gis.stackexchange.com/" target="_blank">gis.stackexchange.com</a> with some screenshots of your data format so I can be certain? I'll send through a step by step answer over at stack exchange with screenshots for you.</p>
<p dir="ltr">Cheers,<br>Nyall</p></blockquote></span></div><div><br></div><div>Nyall, I think I will post the question myself, as I'm curious about how is the correct way to do this in QGIS 2.5 :-P</div><div class="gmail_extra">
<div class="gmail_quote"><div><br></div><div>On Tue, Sep 2, 2014 at 12:30 PM, Sergio Vignali <span dir="ltr"><<a href="mailto:vignalisergio30@gmail.com" target="_blank">vignalisergio30@gmail.com</a>></span> wrote:<br>
</div></div></div></div><div><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr">Hi Alexandre,<div>you say that you know a way to do that with postgis,</div><div>please could you explain that?</div></div></blockquote><div><br></div></span><div>Sergio, not really, it would still need qgis help. Postgis would only facilite things (see below).<br>
</div><div><br></div><div>On Wed, Sep 3, 2014 at 1:18 PM, Thomas Colley <span dir="ltr"><<a href="mailto:t.colley@neath-porttalbot.gov.uk" target="_blank">t.colley@neath-porttalbot.gov.uk</a>></span> wrote:<br></div><span>
<div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-GB"><p class="MsoNormal">
<span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">How about creating a polygon layer with a bounding polygon for all points per species? The polygon features would have the species name as an attribute.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11pt;font-family:Calibri,sans-serif;color:rgb(31,73,125)">You can then use this polygon layer for your atlas and use rule based styling to filter the points based on the species name attribute of the atlas feature.</span></p>
</div></blockquote></div></span></div></div></div><div><br></div><div>Like I said before I think this is not possible since you cannot access the atlas feature atributes from the expression builder, but the idea was that one. Using postgis would just make the task of creating the polygon layer for each specie easier.</div>
<div><br></div><div>Meanwhile, talking with Giovanni Manghi, he came up whit a workaround idea that can actually work quite nice.<br></div><div><br></div><div>One thing you can get from the atlas feature is the feature id (that represents his position on the table). So instead of using the specie name attribute, one could use this ID.</div>
<div><br></div><div>Having a layer with a bounding polygon for each specie, with a column with the specie name, I would do the following:</div><div><br></div><div>- Using field calculator, add a new column (boundary_id) in the boundary polygons layer (the one that will be used in atlas) with it's ID using $id;</div>
<div>- In the data layer (the one with all species presences) join the boundary polygons layer using the specie name;</div><div>- Now use the rulebased symbology on the data layer to filter only the points where "boundary_id" = $atlasfeatureid</div>
<div><br></div><div>Runing atlas generation with the boundary polygons layer, should do what is asked.</div><div><br></div><div>The caveat of this procedure is that any change on the dataset (for example adding a new specie, or removing all presences from another) would require changes in the  boundary feature. This can originate id changes, and to make sure all spicies maps are printed , one should repeat all the steps described before. But, that's much better than doing the map on by one!</div>
<div><br></div><div>BTW, I don't think any other GIS software allow this kind of interation and filtering. Can anyone comment on that?</div><div><br></div><div>Best regards,</div><div><br></div><div>Alexandre Neto</div>
<div><br></div></div>
</blockquote></div><br><br clear="all"><div><br></div></div></div><span><font color="#888888">-- <br><div dir="ltr">Sergio Vignali<div><br></div></div>
</font></span></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr">Sergio Vignali<div><br></div></div>
</div>
</blockquote></div>