[Qgis-developer] [Solved] Python: change query of PostGIS layer

Bernhard Ströbl bernhard.stroebl at jena.de
Thu May 3 05:19:08 PDT 2012


Thanks Ian,

yes I often have to check several classes to find a certain api 
functionality (and sometimes I do not find it). No idea how to improve this.

Am 03.05.2012 11:54, schrieb Ian Packham:
> Thanks Martin
>
> Bernhard - I don't think your problem is unique - I have also been
> trying to do the same thing and spent a long time looking through the
> docs (particularly the API for QgsVectorLayer) to find the solution. I
> think one problem is that I was looking for something like "Query" as in
> the qgis layer, but it is named differently in the docs.
>
> Now I am looking to make a layer invisible (i.e. click the cross next to
> the layer in qgis, but keep the layer). Again I am finding it difficult
> - maybe set in the MapCanvas or Registry?

this is in QgsLegendInterface: setLayerVisible

Bernhard
>
> Ian
>
>  > Dear Martin,
>  >
>  > yes that works. I must have been blindfold, thanks for pointing
>  > it out to me!
>  >
>  > Bernhard
>  >
>  > Am 02.05.2012 23:11, schrieb Martin Dobias:
>  > >On Mon, Apr 30, 2012 at 1:10 PM, Bernhard Ströbl
>  > ><bernhard.stroebl at jena.de> wrote:
>  > >>Hi list,
>  > >>
>  > >>I am trying to change the query of an already loaded PostGIS
>  > layer from
>  > >>within a plugin. Same as if I right-clicked on the layer,
>  > chose "Query..."
>  > >>and entered a WHERE clause there.
>  > >
>  > >That should be as simple as:
>  > >>>>vlayer.setSubsetString("category = 3")
>  > >
>  > >Martin
>  >
>  >
>  >
>  > ________ Information from NOD32 ________
>  > This message was checked by NOD32 Antivirus System for Linux
>  > Mail Server.
>  > http://www.nod32.com
>  > _______________________________________________
>  > Qgis-developer mailing list
>  > Qgis-developer at lists.osgeo.org
>  > http://lists.osgeo.org/mailman/listinfo/qgis-developer




________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com


More information about the Qgis-developer mailing list