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 '18 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.
    – mjrg12
    Nov 15 '18 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 '18 at 8:13
  • Please use the edit button beneath your question to revise it with any requested clarifications.
    – PolyGeo
    Oct 28 '20 at 12:33
-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 '18 at 23:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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