3liz / qgis-pgmetadata-plugin

QGIS Plugin to manage some metadata from PostgreSQL layer
GNU General Public License v2.0
12 stars 10 forks source link

Button for adding all layers of a Theme #89

Open effjot opened 2 years ago

effjot commented 2 years ago

I’m not sure if I understood the goal of the Themes field correctly, but during my evaluation of the plugin, this use case came up:

I have created themes for topics and spatial divisions like

So when I need to get started with a map e.g. for the State of Brandenburg, I would like to add the themes “base information for Brandenburg“ and „hydrogeology Brandenburg“ to have the layers I usually need conventiently loaded all at once.

I have added a button to the dock, which offers me a list selection of database (if more than one DB is connected) and of the available themes. When I select a theme, all the layers in that theme get added as a layer group.

grafik

Is this a use case of general interest? If so, I can prepare a PR.

Gustry commented 2 years ago

Hi,

I think it's a good idea to have this kind of feature.

We were thinking what would the best option to provide this feature :

Option 3 needs to have to dock opened before.

Gustry commented 2 years ago

Side note, but I'm very used to open the "Browser" panel in QGIS to open new files, browser my postgis etc.

I was wondering to have a "PgMetadata" item in this tree, with maybe a tree showing all theme ? and then all layers (with the name formatted nicely from the pgmetadata table).

I know it's redundant with the "Postgis" item, but it's one is ordered by schemas and then by table name. The PgMetadata one would be more "organized" according to pgmetadata table.

image80 commented 2 years ago

A / EXPLORER I think it could have been very interesting to be able to add this scenario: Display of the dock contents as soon as the user selects a table in the explorer. The explorer is for me the most ergonomic access (we see in particular the tree structure of the schemas, of the geometry type). Currently, When we select the table there is the tooltip that shows the abstract pgmetadata. When we right click, the properties of the abstract are also displayed. However, As far as i know, there is currently no search tool in the explorer (unlike the locator or the Data source manager). I don't know if it would be possible to add it?

B / DATA SOURCE MANAGER In my opinion, the search for data in the catalog via the Data source manager is interesting. But currently we can Only search the "comment" field (which is called abstract in pgmetadata). Not possible for example on fields "Key words". Personally, I find the interface of the data source manager not very ergonomic.

C / LOCATOR Searching via the Locator is interesting. But in my opinion it would be necessary to add the possibility of displaying the contents of the dock only by a selection. Without having to load the data into the layer panel. The user should not have to load the layers to be able to select the one that interests him.Especially since some data is voluminous.

D / OTHER IDEA ? TOOL VIA PROCESSING ? OTHER ?

effjot commented 2 years ago

Explorer sounds like a good idea, as this is my first place I turn to for finding and adding stuff. There is a filter tool, though it doesn’t expand the sections it finds results in.

I use the locator mostly for search+add or seach+pan/highlight operations. Putting the „add theme“ there, too, feels a bit overloaded to me.

I added only a button to the dock (with subsequent dialogs) because it was less work. I was too lazy to build a new UI component in the designer for the proof of concept. ;-)

@image80 I originally tried to add the functionality to the processing toolbox, as I had a bit more experience in that area. But I realised that adding layers from there didn’t work as easily as from the dock code.

effjot commented 2 years ago

I’ve tried adding the functionality to the Add Layers menu. This was very straightforward.

However, I have no clue about how to add a new item to the browser panel. The functions seem to be there, but I can’t figure it out, and I haven’t found any plugins I could use as an example.

Gustry commented 2 years ago

I haven’t found any plugins I could use as an example.

Mergin, Geonode are plugins adding custom item in the browser.

QgsBrowserModel from QgisInterface seems the way to go ?

effjot commented 2 years ago

Thank you for the pointers to the plugins! I hope I can have a detailed look in the next few days. I had already found QgsBrowserModel, but couldn’t quite understand how it works. I managed to quickly crash Qgis, though. :-D I just need some time to grok the browser model. ;-)