[Qgis-user] Plugin to add a layer for each unique value in acolumn

James Stott James.Stott at npaconsult.co.uk
Thu Mar 15 08:14:16 PDT 2012


I may have a look at seeing if I can use the shapefile splitter plugin and change it so it adds the layers as queries to the QGIS map canvas rather than saving out shapefiles.

How would you add a selection of an existing layer as a new layer to the map using python(without saving the selection to a file and then adding that files to the map)? The spatial query plugin seems to do this but I cannot find the code to see how it does it.


James Stott BSc (Hons) MSc | Senior Professional
Nicholas Pearson Associates | 30 Brock Street | Bath | BA1 2LN
T: 01225 445548 | M: -
http://www.npaconsult.co.uk/ 

-----Original Message-----
From: qgis-user-bounces at lists.osgeo.org [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of Andreas Neumann
Sent: 15 March 2012 14:33
To: qgis-user at lists.osgeo.org
Subject: RE: [Qgis-user] Plugin to add a layer for each unique value in acolumn

 Ok - so it seems like a reporting / map production problem.

 I am not sure if the "EasyPrint" or "Atlas" Plugin can help. EasyPrint 
 allows to print each feature on a separate map. But it sounds like for 
 your problem easy print would have to be extended to allow for maps per 
 filter or using a group attribute.

 I am not sure if there is an out of the box solution for your problem 
 with QGIS.

 For my own similar projects I set up a printing process using Apache 
 FOP with XSL-FO and then use QGIS-server to print the map extents. I 
 understand that this would be overkill/too much work to setup for you.

 Andreas

 On Thu, 15 Mar 2012 12:50:00 -0000, James Stott wrote:
> Hi Nathan/Andreas,
>
> I would happily use another method to deal with this but I haven’t
> managed to come up with one.
>
> My layer has site boundaries (20 of them) on it. I also have a layer
> with buffers for my sites in it. I have a buffer per site (20 sites)
> and these are from a PostGIS view as these alter whenever I change 
> the
> site boundary. I would like to then add each site boundary and each
> buffer onto a map as a separate layer because:
>
> 1) I add the site boundary and the buffer to a group, then the users
> can then turn each one on and off as needed when looking at the
> project file in QGIS.
>
> 2) For map production (using composers) I have a composer per site. I
> lock the layers in the composer map item and then jpg all my maps at
> the end. To do this I need to have each buffer on a separate layer as
> otherwise it would show the other sites as they are quite close
> together.
>
> The only way I can think to do this at the moment is to add each
> layer 20 times, and then query it by each individual site.
>
> James
>
>
> James Stott BSc (Hons) MSc | Senior Professional
> Nicholas Pearson Associates | 30 Brock Street | Bath | BA1 2LN
> T: 01225 445548 | M: -
> http://www.npaconsult.co.uk/
>
> -----Original Message-----
> From: qgis-user-bounces at lists.osgeo.org
> [mailto:qgis-user-bounces at lists.osgeo.org] On Behalf Of Andreas
> Neumann
> Sent: 15 March 2012 12:10
> To: qgis-user at lists.osgeo.org
> Subject: Re: [Qgis-user] Plugin to add a layer for each unique value
> in acolumn
>
>  Hi James,
>
>  And why would you need that? Maybe there is another solution to your
>  problem with just one or fewer layers.
>
>  Andreas
>
>  On Thu, 15 Mar 2012 11:08:04 -0000, James Stott wrote:
>> I would like to add a layer for each unique value of a text column 
>> in
>> a
>> table.
>>
>> For example, if I have a column called type, and the values in it
>> were
>> tree, stone and plant I would like to add a layer for each type. So
>> in
>> this example I would have 3 layers.
>>
>> I know there is a plugin called Shapefile Splitter that splits out 
>> to
>> a
>> shapefile for each unique value, but I just want it to split to
>> layers
>> in QGIS.
>>
>> James
>>
>>
>> James Stott BSc (Hons) MSc | Senior Professional
>> Nicholas Pearson Associates | 30 Brock Street | Bath | BA1 2LN
>> T: 01225 445548 | M: -
>> http://www.npaconsult.co.uk/
>>
>>
>>
>> 
>> http://www.npaconsult.co.uk/http://www.npaconsult.co.uk/about-news.asp
>> http://www.npaconsult.co.uk/terms.asp
>> This Electronic Transmission is intended only for the attention of
>> the addressee. It may contain privileged and confidential
>> information.
>> If you are not the person for whom it is intended, you must not 
>> copy,
>> distribute or take any action in reliance on it. If you have 
>> received
>> this electronic transmission in error please notify us immediately 
>> by
>> telephone, delete the transmission and destroy any hard copies.
>> Nicholas Pearson Associates has used all reasonable efforts to 
>> ensure
>> that this message and any attachments are free from viruses.
>> Nicholas Pearson Associates, 30 Brock Street, Bath, BA1 2LN , Tel:
>> +44 (0) 01225 445548, Fax: +44 (0) 01225 312387, Website:
>> http://www.npaconsult.co.uk/
>> _______________________________________________
>> Qgis-user mailing list
>> Qgis-user at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> --
>  --
>  Andreas Neumann
>  Böschacherstrasse 10A
>  8624 Grüt (Gossau ZH)
>  Switzerland
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
> 
> http://www.npaconsult.co.uk/http://www.npaconsult.co.uk/about-news.asp
> http://www.npaconsult.co.uk/terms.asp
> This Electronic Transmission is intended only for the attention of
> the addressee. It may contain privileged and confidential 
> information.
> If you are not the person for whom it is intended, you must not copy,
> distribute or take any action in reliance on it. If you have received
> this electronic transmission in error please notify us immediately by
> telephone, delete the transmission and destroy any hard copies.
> Nicholas Pearson Associates has used all reasonable efforts to ensure
> that this message and any attachments are free from viruses.
> Nicholas Pearson Associates, 30 Brock Street, Bath, BA1 2LN , Tel:
> +44 (0) 01225 445548, Fax: +44 (0) 01225 312387, Website:
> http://www.npaconsult.co.uk/
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-- 
 --
 Andreas Neumann
 Böschacherstrasse 10A
 8624 Grüt (Gossau ZH)
 Switzerland
_______________________________________________
Qgis-user mailing list
Qgis-user at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

http://www.npaconsult.co.uk/http://www.npaconsult.co.uk/about-news.asp
http://www.npaconsult.co.uk/terms.asp
This Electronic Transmission is intended only for the attention of the addressee. It may contain privileged and confidential information. If you are not the person for whom it is intended, you must not copy, distribute or take any action in reliance on it. If you have received this electronic transmission in error please notify us immediately by telephone, delete the transmission and destroy any hard copies.
Nicholas Pearson Associates has used all reasonable efforts to ensure that this message and any attachments are free from viruses.
Nicholas Pearson Associates, 30 Brock Street, Bath, BA1 2LN , Tel: +44 (0) 01225 445548, Fax: +44 (0) 01225 312387, Website: http://www.npaconsult.co.uk/



More information about the Qgis-user mailing list