[Qgis-user] Automatically force reload layer from source (geojson)
Richard Duivenvoorde
rdmailings at duif.net
Sat Nov 23 01:53:25 PST 2019
Mmm, thinking out loud here; actionslike 'disable cache' per layer, or
'refresh layer every x minute' are more functions for the view, isn't it?
As: a provider should just do what it suppossed to do: either fetch all
data (like you do with a geojson url) or a part of it (like you do with
a wfs or postgres provider which only fetch within a bbox)...
I've been a (potential fan) of Martin's work about 'Embedded Layer
Widgets', see
http://www.qgis.nl/2019/02/14/about-layer-tree-embedded-widgets-and-have-your-wmts-always-crispy-sharp/?lang=en
Martin's example there was an opacity slider, and I created a slider to
always click to fixed scales.
But I think with not so much work it should be possible to create a
widget (in python, AND package it as a normal QGIS plugin) with
functionality like: refresh every x (input) seconds, or create a
'refresh' button in the Layermanager...
What you think?
Regards,
Richard
On 22/11/2019 23.55, Olivier Dalang wrote:
> Hah !! Indeed ! F5 works as you say... No idea how I missed this !
>
> Thanks !! :-)
>
> However, geojsons don't update here (win 10) without F5, even when
> panning. It would be nice to be able to disable cache completely per
> layer, and/or allow to have "refresh layer at interval" also reload from
> source. What do you think? Should I open a feature request ?
>
> Cheers,
>
> Olivier
>
>
>
> On Fri, 22 Nov 2019 at 23:32, Mike Flannigan <mikeflan at att.net
> <mailto:mikeflan at att.net>> wrote:
>
>
> That is correct. On Win7 I just zoomed in or out
> after the file was revised and it updated to the
> new geoj immediately. I did not try F5, but that
> should work also.
>
> I am now on Linux Mint. Let me know if you want
> me to check it on this system.
>
>
> Mike
>
>
> On 11/22/19 2:00 PM, qgis-user-request at lists.osgeo.org
> <mailto:qgis-user-request at lists.osgeo.org> wrote:
>> Date: Fri, 22 Nov 2019 14:38:33 +0100
>> From: Richard Duivenvoorde <rdmailings at duif.net> <mailto:rdmailings at duif.net>
>> To: Olivier Dalang <olivier.dalang at gmail.com> <mailto:olivier.dalang at gmail.com>, qgis-user
>> <qgis-user at lists.osgeo.org> <mailto:qgis-user at lists.osgeo.org>
>> Subject: Re: [Qgis-user] Automatically force reload layer from source
>> (geojson)
>>
>>
>> Hi Olivier,
>>
>> Does F5 (refresh, from menu 'View/Refresh') not work?
>>
>> I thought that when I had an (live changing) online geojson source, (and
>> added as url), I could easily 'reload' fresh data via F5
>>
>> Not working for you?
>>
>> Regards,
>>
>> Richard Duivenvoorde
>>
>>
>>
>> On 22/11/2019 14.12, Olivier Dalang wrote:
>>> Dear list,
>>>
>>> Currently, when I load a geojson into QGIS, and modify the geojson file
>>> using an other software, the change isn't reflected in QGIS. The only
>>> way to reflect the change is to re-add the layer, or to run
>>> `iface.activeLayer().dataProvider().forceReload()` in the python console.
>>>
>>> I see could find neither a button or menu to trigger a reload manually,
>>> nor the option to do it automatically, nor a way to disable caching of
>>> such layers (which anyway would be suitable for very small layers only).
>>>
>>> Ideally, I was looking for an option like the "refresh layer at
>>> interval" options from the layer properties>rendering dialog (that
>>> option seems to just re-render the file, without reloading it, so that
>>> it doesn't work for my purpose).
>>>
>>> Thanks !
>>>
>>> Olivier
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org <mailto:Qgis-user at lists.osgeo.org>
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
More information about the Qgis-user
mailing list