9

Is there a tool or panel in QGIS 3 that allows a user to view the map layers by data source? Similar to the List By Source view in the ArcMap Table of Contents?
enter image description here

I thought I had come across it, but now I can't find it. Perhaps I dreamt it up or perhaps I'm searching with the wrong vocabulary.

Does this capability exist in the core QGIS software? Or a plugin?

1

You can get the list of the layers in the current project with a PyQGIS script like this:

from qgis.core import QgsProject
lnames = [layer.name() for layer in QgsProject.instance().mapLayers().values()]
print(lnames)

To access the PyQGIS console: Plugins -> Python Console

this produces a list of layers in the current project:

['GoogleSat', 'MyPointsLayer', 'Roads', 'House_numbers']

(Not by source though)

Other scripts you might find useful can be found in the PyQGIS Cookbook: https://docs.qgis.org/3.4/en/docs/pyqgis_developer_cookbook/cheat_sheet.html#layers

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.