I have a layer of points with placenames (2000+ features). I use subsets of the data for many projects (various themes that need different placenames, variable map scales for the same project, a main map and inset map, an atlas where placenames are shared between two atlas pages at various scales, several label styles for different regions).
I need to find a way to have multiple derivatives of the master layer that allow for multiple instances of a single label using QGIS 3.
Rationale:
- Some of the placename spellings get updated every year (why? Indigenous language), and I want to correct the spelling in a single file and have it trickle out to all derivatives of the master layer.
- I often need to make many maps at different scales using the same labels
Theoretical Framework:
- A master file of placenames that I can update annually (any row/column format as long as it can be imported into or be joined to a visualization in QGIS)
- Multiple derivatives of the master file that can have different label placement (must be usable in QGIS 3)
- Subsets for each derivative in a project can be managed using SQL queries or rule-based styling
Duplicate layers get me part way there (a derivative of a master layer that can be queried/styled independently of the master layer), but I cannot figure out how to create separate auxiliary storage for labels for each duplicate.
This question has been asked in slightly different ways several times, but I have yet to see a viable solution:
- Currently, I have many separate gpkg subsets but it is impossible/inefficient to keep them up to date
- I have stored multiple X/Y locations in a single file and used rule-based styling, but that has become untenable because of the high number of maps
- Locking the layers/styles in the print composer is not viable because I have to do multiple revisions and can't spend the time doing things twice (move labels, then re-freeze main map, move labels back for inset map)
- I have tried duplicate layers (shares label placement between duplicates)
- Themes share label placement (maybe I'm missing something here?)
- Auxiliary storage is tied to the project and limited to a single instance of the file in each project (maybe?)
- I have tried virtual layers (can't move labels in the virtual layer)
- Here they frame it as a duplicate label question
- Here they frame it in the context of two maps in the print composer
- Here it is also about two maps in the print composer
- Another one about inset maps
- Here they claim it "can be achieved with a combination of named styles with themes and auxiliary storage" but they don't offer anything more than that single sentence
- Unclear if the Easy Label Plugin would do it. I don't think it would allow for the update from the master file since it creates a new temporary layer with no ties to the original layer
-
1Not sure if I understood your problem, but what about using 1) data driven plaement of labels, 2) a separate, data only layer in each project, containing point-id and the x-/y-values for label placement, 3) a join between this data layer and your point layer?Babel– Babel2024年11月27日 20:36:25 +00:00Commented Nov 27, 2024 at 20:36
-
Apologies if I have missed something, how about having your place names in a separate table with columns for the different name styles but a UUID that you other layers can link toSethinacan– Sethinacan2024年11月28日 08:06:58 +00:00Commented Nov 28, 2024 at 8:06
-
What about rule based labels with different placement rules for each rule? i often do this, then its just one layer, but the rules have no filter and i can just use the checkbox to decide which one to employ depending on scale and context.gotjosh– gotjosh2025年02月05日 17:03:48 +00:00Commented Feb 5 at 17:03
-
@gotjosh I don't unerstand our suggestion. How do I define/store the xy of the label placement? Do you mean use different placenaments in the label panel?CD.Edwards– CD.Edwards2025年02月06日 18:51:21 +00:00Commented Feb 6 at 18:51
-
Well, to the limited extent that understand your use case and readiness to dive into the nasty details of qgis conditional rendering and scale dependent rules... I suggest that you add labelX and labelY fields to the geometry layer (using the attribute table). Then you can use role based styling and tweak the scale dependent settings and create different sets of styles for your different scenarios. I question the appropriateness of an external master file, I would prefer to have the layer data be my source of truth.gotjosh– gotjosh2025年02月07日 22:58:40 +00:00Commented Feb 7 at 22:58
1 Answer 1
You can achieve this in the following way - if I understand your problem correctly - you don't need duplicates of your layer, only named styles, themes and the auxiliary storage to store the placement of your labels:
make different styles for different label options and put them into the style tab of the Layer Styling Panel, in this example I have two different label styles points with labels (default style) and HTML Labels with images, new feature in 3.40) enter image description here
for each Style add a new theme, in the example they are called A and B enter image description here
for each label style add additional positionX and Y columns in the auxiliary table, which we will use in the different styles enter image description here
in each style you can use the different auxiliary storage columns and to store different label positions for the different styles: PositionX/PositionY for A and PositionX2/PositionY2 for B and so on enter image description here
now you can have different labelpositions in each style
finally use the different themes (A and B) for different composer maps enter image description here
-
This works well. It can get a bit cumbersome if you decide to change something in the style and you have a lot of maps/auxiliary XY fields, but it does work very well. I had never noticed the section where I can add new auxiliary fields. That's a great tip.CD.Edwards– CD.Edwards2025年04月03日 21:37:38 +00:00Commented Apr 3 at 21:37