1

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:

  1. 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.
  2. I often need to make many maps at different scales using the same labels

Theoretical Framework:

  1. 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)
  2. Multiple derivatives of the master file that can have different label placement (must be usable in QGIS 3)
  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:

Taras
35.7k5 gold badges77 silver badges151 bronze badges
asked Nov 27, 2024 at 20:18
5
  • 1
    Not 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? Commented 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 to Commented 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. Commented 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? Commented 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. Commented Feb 7 at 22:58

1 Answer 1

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:

  1. 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

  2. for each Style add a new theme, in the example they are called A and B enter image description here

  3. 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

  4. 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

  5. now you can have different labelpositions in each style

  6. finally use the different themes (A and B) for different composer maps enter image description here

answered Nov 28, 2024 at 6:55
1
  • 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. Commented Apr 3 at 21:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.