Hi,
I am looking for a way to audit a QGIS projects in terms of layer rendering
time.
I was able to measuring the rendering every time I refresh the the map
canvas, change layers or change extent, using the following code (inspired
by Anita code):
from datetime import datetime
def get_time():
t1 = datetime.now()
print('Rendering time:',t1-t0, 'seconds')
def reset_time():
global t0
t0 = datetime.now()
canvas = iface.mapCanvas()
canvas.mapCanvasRefreshed.connect(get_time)
canvas.extentsChanged.connect(reset_time)
canvas.layersChanged.connect(reset_time)
Now, I wanted to programmatically zoom in, zoom out, enable and disable
layers, etc... but If I give two or more of these commands together, each
command won't wait for the other to finish rendering, therefore I am unable
to measure the time.
For example:
iface.actionZoomFullExtent()
canvas.zoomByFactor(0.5)
Only returns the time for the last zoom to render.
I have tried using time.wait() but that stops the rendering all together.
Thanks,
Alexandre Neto
_______________________________________________
QGIS-User mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user