[Qgis-developer] 'reload' a layer

G. Allegri giohappy at gmail.com
Wed May 16 08:36:44 PDT 2012

Do you mean refresh the rendering or synchronizing the layer with the data
I usually use QgsMapLayer::reload() for the latter, and
QgsMapCanvas::refresh() for the first.


2012/5/16 Carson Farmer <carson.farmer at gmail.com>

> Hi list, does anyone know of a clever way to (programmatically) reload
> a layer without actually removing it and re-adding it to the layer
> list. Some context: I have a layer that sometimes gets updated by an
> external application, and I want to be able to 'refresh' the layer
> from the Python console to reflect these changes (new features,
> deleted features, new attributes, etc.). I *could* simply load the
> layer again, but I'm hoping there is a more efficient way to do this
> (also I want to keep the current styling, layer order, unique layer
> id, etc).
> Any thoughts/ideas? Note: assume we are working with a spatialite layer
> for now.
> Carson
> --
> Dr. Carson J. Q. Farmer
> Centre for GeoInformatics (CGI)
> School of Geography and Geosciences
> Irvine Building, University of St Andrews
> St Andrews, Fife, KY16 9AL
> Scotland, UK
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120516/18d2cab2/attachment.html

More information about the Qgis-developer mailing list