[Qgis-developer] QgsMapLayerRegistry.mapLayers() not available in Python Bindings

Martin Dobias wonder.sk at gmail.com
Fri Jan 11 06:30:04 EST 2008


On Jan 11, 2008 11:40 AM, Barry Rowlingson <b.rowlingson at lancaster.ac.uk> wrote:
>
> You can get all the layers in the current map canvas from the console thus:
>
> # get the map canvas
> mc=iface.getMapCanvas()
>
> # how many layers are there?
> nLayers=mc.layerCount()
>
> # loopage:
>
> for l in range(nLayers):
>    layer = mc.getZpos(l)
>    doSomethingWith(layer)
>
>   - is that good enough?

Well, it doesn't include hidden layers....

Martin



More information about the Qgis-developer mailing list