3

I want to update a single vector layer as I am working on 8 vector layers and they are getting fast data from serial port so for updating I use mapCanvas().refresh() which refresh all the layer and I have almost 20 static S57 layer so the refresh takes a long time.

1 Answer 1

3

Not sure if there is a direct way at this date, but my guess there isn't. But this might help you:

http://osgeo-org.1803224.n2.nabble.com/refresh-one-layer-td4427445.html

It's kind of possible. From 1.4 release there's support for caching of rendered layers (turned off by default). You can turn it on in options dialog. Then always make sure to erase cache for the layer that has been changed (layer.setCacheImage(None)). It will get rendered again, while the rest of the layers should stay untouched (their cache image will be displayed).

4
  • no thats not working Jul 18, 2011 at 7:24
  • That's strange, for me it is working. But I don't change extents or do any other modifications to other layers for example this fucntion: mainLayer = iface.activeLayer() mainLayer.invertSelection() iface.mapCanvas().refresh() was very long with no cache and very quick with it. Jul 18, 2011 at 7:53
  • kindly tell me the procedure I m using QGIS 1.6
    – user3700
    Jul 19, 2011 at 4:36
  • >kindly tell me the procedure I m using QGIS 1.6. I will comment it here. Firstly use 1.7. Go to Settings > Options>select Rendering>Use render caching where possible to speed up redraws. Restart Qgis (probably not needed, but whatever, will not hurt anybody). Now if you make changes to one layer only, qgis should leave the rest as they are. However if you zoom in/out/do other modifications for all layers, it will redraw all of them (tested by me). Jul 19, 2011 at 6:12

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.