[Qgis-developer] Changing the Filter of an existing layer
Anita Graser
anitagraser at gmx.at
Wed Jun 20 10:23:22 PDT 2012
Yes, I call
self.iface.mapCanvas().refresh()
Best wishes,
Anita
On Wed, Jun 20, 2012 at 5:25 PM, Andreas Neumann <a.neumann at carto.net>wrote:
> Thanks Anita - easier than I thought.
>
> Apparently one has to refresh the canvas after setting the subsetString.
>
> Is that how you do it in Time Manager?
>
> Thanks,
> Andreas
>
>
> On Wed, 20 Jun 2012 17:04:49 +0200, Anita Graser wrote:
>
>> Hi Andreas,
>>
>> layer.setSubsetString( subsetString ) seems the way to go. At least
>> that's what I use in Time Manager ;)
>>
>> Best wishes,
>>
>> Anita
>>
>> On Wed, Jun 20, 2012 at 4:49 PM, Andreas Neumann wrote:
>>
>> Hi,
>>>
>>> For an existing layer I would like to add/change/remove the WHERE
>>> filter by script - the same that one would normally set by the query
>>> builder.
>>>
>>> Do I need to change the QgsDataSourceURI() of that QgsVectorLayer
>>> and then reload it or is there an easier/more elegant way to change
>>> the filter of an existing layer?
>>>
>>> Thanks if you have any ideas or even sample code on how to achieve
>>> this.
>>>
>>> Andreas
>>>
>>> --
>>> --
>>> Andreas Neumann
>>> Böschacherstrasse 10A
>>> 8624 Grüt (Gossau ZH)
>>> Switzerland
>>> _______________________________________________
>>> Qgis-developer mailing list
>>> Qgis-developer at lists.osgeo.org [1]
>>> http://lists.osgeo.org/mailman/listinfo/qgis-developer [2]
>>>
>>
>>
>>
>> Links:
>> ------
>> [1] mailto:Qgis-developer at lists.osgeo.org
>> [2] http://lists.osgeo.org/mailman/listinfo/qgis-developer
>> [3] mailto:a.neumann at carto.net
>>
>
> --
> --
> Andreas Neumann
> Böschacherstrasse 10A
> 8624 Grüt (Gossau ZH)
> Switzerland
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120620/f09da933/attachment.html>
More information about the Qgis-developer
mailing list