Do you mean refresh the rendering or synchronizing the layer with the data source?<div>I usually use QgsMapLayer::reload() for the latter, and QgsMapCanvas::refresh() for the first.</div><div><br></div><div>giovanni<br><br>
<div class="gmail_quote">2012/5/16 Carson Farmer <span dir="ltr">&lt;<a href="mailto:carson.farmer@gmail.com" target="_blank">carson.farmer@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi list, does anyone know of a clever way to (programmatically) reload<br>
a layer without actually removing it and re-adding it to the layer<br>
list. Some context: I have a layer that sometimes gets updated by an<br>
external application, and I want to be able to &#39;refresh&#39; the layer<br>
from the Python console to reflect these changes (new features,<br>
deleted features, new attributes, etc.). I *could* simply load the<br>
layer again, but I&#39;m hoping there is a more efficient way to do this<br>
(also I want to keep the current styling, layer order, unique layer<br>
id, etc).<br>
<br>
Any thoughts/ideas? Note: assume we are working with a spatialite layer for now.<br>
<span class="HOEnZb"><font color="#888888"><br>
Carson<br>
<br>
--<br>
Dr. Carson J. Q. Farmer<br>
Centre for GeoInformatics (CGI)<br>
School of Geography and Geosciences<br>
Irvine Building, University of St Andrews<br>
St Andrews, Fife, KY16 9AL<br>
Scotland, UK<br>
_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
</font></span></blockquote></div><br></div>