1

Is it possible to automatically refresh the QGIS map canvas in the background?

I have a .geojson file with the data. This data changes (in case of a simulation) but the map canvas only refreshes after I press the F5 button (refresh). In my case it should refresh the map every 100msec.

In the "layer properties/Rendering" there is a option "Refresh layer at interval (seconds)". I activated this but it has not the function I've searched for.

I found the command for the Python Console: iface.mapCanvas().refreshAllLayers(). This is exactly the function I've searched for. But I need it called periodically in the background. I tried this with a self-written plugin, but without success. (Python script with an endless loop -> GUI freezes)

4
  • 1
    " I activated this but it has not the function I've searched for." Can you clarify? That's the correct option to use for this use case.
    – ndawson
    Nov 14, 2018 at 23:40
  • This should be a comment to the topic (Sorry for that I'm new to stackexchange)... @ndawson I've activated the "Refresh layer at interval (seconds)" and set it for example to 1.00s. Then I open the .geojson file (it is only one point to draw) and change its coordinates and safe the file. Now the point should move to the new coordinates after 1.00 second. But nothing happens until I press the F5 button or I write the command iface.mapCanvas().refreshAllLayers() in the python console.
    – user131882
    Nov 15, 2018 at 6:44
  • This is an answer for QGIS 2, but I think if you just remove the layer replace the contents of repainit() with iface.mapCanvas().refreshAllLayers(), it will work: gis.stackexchange.com/questions/189634/…
    – wfgeo
    Nov 15, 2018 at 8:13
  • Please use the edit button beneath your question to revise it with any requested clarifications.
    – PolyGeo
    Oct 28, 2020 at 12:33

1 Answer 1

-3

Go to: Settings menu > Options > Rendering tab > Change map update interval to 100 ms

enter image description here

If this doesn't work, make a bug report at https://issues.qgis.org.

1
  • This isn't an answer to the original question -- this setting just changes how frequently the drawing happens WHILE a map redraw is in progress
    – ndawson
    Nov 14, 2018 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.