[Qgis-user] Atlas generation - help please

Alexandre Neto senhor.neto at gmail.com
Sat Sep 13 04:01:52 PDT 2014


Hello Sergio,

You can use a view,  all you need is to recreate an id with unique values
to use as key in qgis.

This will do:

With query as
(SELECT * FROM specie_a UNION ALL SELECT * FROM specie_B UNION ALL
SELECT....)
SELECT rownumber() over() as id, query.*
FROM query

Best regards,

Alexandre Neto
Em 12/09/2014 21:11, "Sergio Vignali" <vignalisergio30 at gmail.com> escreveu:

> Thanks Alexandre,
>
> now I understood and it work fine! I created an union table as followed
> your explanation.
> I try to better explain:
> I have a table for each species in postgis, I created a table like that:
>
> CREATE TABLE atlas AS SELECT * FROM specie_a UNION ALL SELECT * FROM
> specie_B UNION ALL SELECT....
>
> I created a polygon layer with several polygons but all equal to itself
> and with a field with the name of the specie
>
> then the join and the ruled based style as you described and all is fine
>
> 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?
> You can find two images below:
>
> https://www.dropbox.com/s/rq5ysd6lcfic5zp/atlas1.png?dl=0
> https://www.dropbox.com/s/fyd0w2ztiuddvyj/atlas2.png?dl=0
>
> All the best
>
> 2014-09-12 17:36 GMT+02:00 Alexandre Neto <senhor.neto at gmail.com>:
>
>> Hello Sergio,
>>
>> 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.
>>
>> Anyway, regarding the basemap, I'm not sure about what you are asking.
>> but you can create the grid yourself.
>>
>> Alexandre Neto
>>
>>
>>
>> On Fri, Sep 12, 2014 at 1:51 PM, Sergio Vignali <
>> vignalisergio30 at gmail.com> wrote:
>>
>>> Hi Alexandre,
>>> 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.
>>> 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.
>>> What solution you suggest?
>>>
>>> All the best
>>>
>>> Sergio
>>>
>>> 2014-09-03 15:51 GMT+02:00 Alexandre Neto <senhor.neto at gmail.com>:
>>>
>>>> Hello all,
>>>>
>>>> On Mon, Sep 1, 2014 at 9:52 PM, Nyall Dawson <nyall.dawson at gmail.com>
>>>>  wrote:
>>>>
>>>>> 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 gis.stackexchange.com 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.
>>>>>
>>>>> Cheers,
>>>>> Nyall
>>>>>
>>>>
>>>> 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
>>>>
>>>> On Tue, Sep 2, 2014 at 12:30 PM, Sergio Vignali <
>>>> vignalisergio30 at gmail.com> wrote:
>>>>
>>>>> Hi Alexandre,
>>>>> you say that you know a way to do that with postgis,
>>>>> please could you explain that?
>>>>>
>>>>
>>>> Sergio, not really, it would still need qgis help. Postgis would only
>>>> facilite things (see below).
>>>>
>>>> On Wed, Sep 3, 2014 at 1:18 PM, Thomas Colley <
>>>> t.colley at neath-porttalbot.gov.uk> wrote:
>>>>
>>>>> 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.
>>>>>
>>>>>
>>>>>
>>>>> 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.
>>>>>
>>>>
>>>> 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.
>>>>
>>>> Meanwhile, talking with Giovanni Manghi, he came up whit a workaround
>>>> idea that can actually work quite nice.
>>>>
>>>> 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.
>>>>
>>>> Having a layer with a bounding polygon for each specie, with a column
>>>> with the specie name, I would do the following:
>>>>
>>>> - 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;
>>>> - In the data layer (the one with all species presences) join the
>>>> boundary polygons layer using the specie name;
>>>> - Now use the rulebased symbology on the data layer to filter only the
>>>> points where "boundary_id" = $atlasfeatureid
>>>>
>>>> Runing atlas generation with the boundary polygons layer, should do
>>>> what is asked.
>>>>
>>>> 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!
>>>>
>>>> BTW, I don't think any other GIS software allow this kind of interation
>>>> and filtering. Can anyone comment on that?
>>>>
>>>> Best regards,
>>>>
>>>> Alexandre Neto
>>>>
>>>>
>>>
>>>
>>> --
>>> Sergio Vignali
>>>
>>>
>>
>
>
> --
> Sergio Vignali
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20140913/b5511e34/attachment.html>


More information about the Qgis-user mailing list