How to create a label containing values from different layers in QGISHow to share styles between layers in...

Article. The word "Respect"

Does Skippy chunky peanut butter contain trans fat?

What to do with threats of blacklisting?

Broad Strokes - missing letter riddle

How is this property called for mod?

What is the wife of a henpecked husband called?

Count repetitions of an array

How to write cases in LaTeX?

Stuck on a Geometry Puzzle

What are some ways of extending a description of a scenery?

What does MTU depend on?

Does an Eldritch Knight's Weapon Bond protect him from losing his weapon to a Telekinesis spell?

Subsurf on a crown. How can I smooth some edges and keep others sharp?

How to completely remove a package in Ubuntu (like it never existed)

How to politely refuse in-office gym instructor for steroids and protein

How to not let the Identify spell spoil everything?

Potential client has a problematic employee I can't work with

Is `Object` a function in javascript?

Time-efficient matrix elements grouping and summing

Could a warlock use the One with Shadows warlock invocation to turn invisible, and then move while staying invisible?

How do you get out of your own psychology to write characters?

Prevent Nautilus / Nemo from creating .Trash-1000 folder in mounted devices

Why is that max-Q doesn't occur in transonic regime?

Does diversity provide anything that meritocracy does not?



How to create a label containing values from different layers in QGIS


How to share styles between layers in QGISHow to show labels for all polygons in a layer, even with 'NULL' values?How to display multiple attributes in a QGIS Composer legend?Can labels for overlapping points be combined/merged into one label?Single label for multiple features with different values in ArcGIS Desktop?Summing pixel values from several raster layers with partial overlap in QGIS?Summing values from different intersecting/overlapping points in QGISlabeling feature based on defined Value Map in QGIS?Suppress same label from different features QGisHow do I split subjacent lines and merge attributes in order to label them in QGIS













5















I have several layers which are stagged on each other. I need to create a label (or text-window / description, doesn't matter) which should contain values from different layers. Creating a regular label I can only choose attributes from this layer. Because the features have different nodes, it is not possible to just merge the layers.










share|improve this question









New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Yes,but I can only select fields and values from the layer you are working on. I need to create a label / textwindow containing values from multiple layers.

    – KReisser
    7 hours ago











  • I think it is not possible, because QGIS can not know where the "imported" feature is, therefore not choose the right value from the table. That's why I asked another question: how to split lines and merge the attributes

    – KReisser
    7 hours ago
















5















I have several layers which are stagged on each other. I need to create a label (or text-window / description, doesn't matter) which should contain values from different layers. Creating a regular label I can only choose attributes from this layer. Because the features have different nodes, it is not possible to just merge the layers.










share|improve this question









New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





















  • Yes,but I can only select fields and values from the layer you are working on. I need to create a label / textwindow containing values from multiple layers.

    – KReisser
    7 hours ago











  • I think it is not possible, because QGIS can not know where the "imported" feature is, therefore not choose the right value from the table. That's why I asked another question: how to split lines and merge the attributes

    – KReisser
    7 hours ago














5












5








5


3






I have several layers which are stagged on each other. I need to create a label (or text-window / description, doesn't matter) which should contain values from different layers. Creating a regular label I can only choose attributes from this layer. Because the features have different nodes, it is not possible to just merge the layers.










share|improve this question









New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I have several layers which are stagged on each other. I need to create a label (or text-window / description, doesn't matter) which should contain values from different layers. Creating a regular label I can only choose attributes from this layer. Because the features have different nodes, it is not possible to just merge the layers.







qgis labeling






share|improve this question









New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 7 hours ago







KReisser













New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 8 hours ago









KReisserKReisser

314




314




New contributor




KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






KReisser is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • Yes,but I can only select fields and values from the layer you are working on. I need to create a label / textwindow containing values from multiple layers.

    – KReisser
    7 hours ago











  • I think it is not possible, because QGIS can not know where the "imported" feature is, therefore not choose the right value from the table. That's why I asked another question: how to split lines and merge the attributes

    – KReisser
    7 hours ago



















  • Yes,but I can only select fields and values from the layer you are working on. I need to create a label / textwindow containing values from multiple layers.

    – KReisser
    7 hours ago











  • I think it is not possible, because QGIS can not know where the "imported" feature is, therefore not choose the right value from the table. That's why I asked another question: how to split lines and merge the attributes

    – KReisser
    7 hours ago

















Yes,but I can only select fields and values from the layer you are working on. I need to create a label / textwindow containing values from multiple layers.

– KReisser
7 hours ago





Yes,but I can only select fields and values from the layer you are working on. I need to create a label / textwindow containing values from multiple layers.

– KReisser
7 hours ago













I think it is not possible, because QGIS can not know where the "imported" feature is, therefore not choose the right value from the table. That's why I asked another question: how to split lines and merge the attributes

– KReisser
7 hours ago





I think it is not possible, because QGIS can not know where the "imported" feature is, therefore not choose the right value from the table. That's why I asked another question: how to split lines and merge the attributes

– KReisser
7 hours ago










2 Answers
2






active

oldest

votes


















5














You can create a virtual layer that will compute the intersection between the layers and retrieve the desired values to be labeled. Then you would put a label on this virtual layer.



Here is an example between two line layers, but this approach can be generalized to other types.



Go to the menu Layer / Add layer / Add - Edit virtual layer and put the following definition:



SELECT a.myField nameA, b.myField nameB, st_intersection(a.geometry, b.geometry)
FROM myLayer1 a, myLayer2 b
WHERE st_intersects(a.geometry, b.geometry)


This will create a new layer. Label it using the formula nameA || nameB or any other one that would concatenate the information to be shown.



enter image description here






share|improve this answer


























  • That is magnificent!

    – Taras
    7 hours ago











  • @Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

    – JGH
    7 hours ago











  • Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

    – Taras
    7 hours ago











  • Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

    – KReisser
    7 hours ago













  • @KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

    – JGH
    6 hours ago





















2














Have a look at the refFunctions Plugin. It allows you to create a reference to another layer and you can specify the field you want to reference:



Setup:




  • Point layer named points with id and field1 fields

  • Polygon layer named poly with id field


to Create the label for the poly layer I used this:



concat("id", ' with other ID: ', geomcontains('points', 'id') ,' and name :' ,  geomcontains('points', 'field1'))


Where:




  • "id" is the ID field of poly

  • geomcontains is the function from refFunctions

  • 'points' references my points layer and

  • 'id' is the ID field of points


Be aware this creates problems when you have many features inside one feature of the other layer (see gif for reference)
enter image description here






share|improve this answer
























  • Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

    – KReisser
    5 hours ago











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "79"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






KReisser is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313464%2fhow-to-create-a-label-containing-values-from-different-layers-in-qgis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














You can create a virtual layer that will compute the intersection between the layers and retrieve the desired values to be labeled. Then you would put a label on this virtual layer.



Here is an example between two line layers, but this approach can be generalized to other types.



Go to the menu Layer / Add layer / Add - Edit virtual layer and put the following definition:



SELECT a.myField nameA, b.myField nameB, st_intersection(a.geometry, b.geometry)
FROM myLayer1 a, myLayer2 b
WHERE st_intersects(a.geometry, b.geometry)


This will create a new layer. Label it using the formula nameA || nameB or any other one that would concatenate the information to be shown.



enter image description here






share|improve this answer


























  • That is magnificent!

    – Taras
    7 hours ago











  • @Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

    – JGH
    7 hours ago











  • Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

    – Taras
    7 hours ago











  • Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

    – KReisser
    7 hours ago













  • @KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

    – JGH
    6 hours ago


















5














You can create a virtual layer that will compute the intersection between the layers and retrieve the desired values to be labeled. Then you would put a label on this virtual layer.



Here is an example between two line layers, but this approach can be generalized to other types.



Go to the menu Layer / Add layer / Add - Edit virtual layer and put the following definition:



SELECT a.myField nameA, b.myField nameB, st_intersection(a.geometry, b.geometry)
FROM myLayer1 a, myLayer2 b
WHERE st_intersects(a.geometry, b.geometry)


This will create a new layer. Label it using the formula nameA || nameB or any other one that would concatenate the information to be shown.



enter image description here






share|improve this answer


























  • That is magnificent!

    – Taras
    7 hours ago











  • @Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

    – JGH
    7 hours ago











  • Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

    – Taras
    7 hours ago











  • Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

    – KReisser
    7 hours ago













  • @KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

    – JGH
    6 hours ago
















5












5








5







You can create a virtual layer that will compute the intersection between the layers and retrieve the desired values to be labeled. Then you would put a label on this virtual layer.



Here is an example between two line layers, but this approach can be generalized to other types.



Go to the menu Layer / Add layer / Add - Edit virtual layer and put the following definition:



SELECT a.myField nameA, b.myField nameB, st_intersection(a.geometry, b.geometry)
FROM myLayer1 a, myLayer2 b
WHERE st_intersects(a.geometry, b.geometry)


This will create a new layer. Label it using the formula nameA || nameB or any other one that would concatenate the information to be shown.



enter image description here






share|improve this answer















You can create a virtual layer that will compute the intersection between the layers and retrieve the desired values to be labeled. Then you would put a label on this virtual layer.



Here is an example between two line layers, but this approach can be generalized to other types.



Go to the menu Layer / Add layer / Add - Edit virtual layer and put the following definition:



SELECT a.myField nameA, b.myField nameB, st_intersection(a.geometry, b.geometry)
FROM myLayer1 a, myLayer2 b
WHERE st_intersects(a.geometry, b.geometry)


This will create a new layer. Label it using the formula nameA || nameB or any other one that would concatenate the information to be shown.



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 6 hours ago

























answered 7 hours ago









JGHJGH

12.7k21137




12.7k21137













  • That is magnificent!

    – Taras
    7 hours ago











  • @Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

    – JGH
    7 hours ago











  • Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

    – Taras
    7 hours ago











  • Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

    – KReisser
    7 hours ago













  • @KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

    – JGH
    6 hours ago





















  • That is magnificent!

    – Taras
    7 hours ago











  • @Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

    – JGH
    7 hours ago











  • Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

    – Taras
    7 hours ago











  • Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

    – KReisser
    7 hours ago













  • @KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

    – JGH
    6 hours ago



















That is magnificent!

– Taras
7 hours ago





That is magnificent!

– Taras
7 hours ago













@Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

– JGH
7 hours ago





@Taras :-) Virtual layers are truly powerful! I believe they should be much more advertised

– JGH
7 hours ago













Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

– Taras
7 hours ago





Exactly! Once @J.R gave me a hint and afterwards I started to use them by myself. It helps a lot!

– Taras
7 hours ago













Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

– KReisser
7 hours ago







Wow that looks promising. Thank you very much! I tried it but it says "Referenced table a in query not found" . what are the variables to be changed? nameA/nameB are my layer-names, what else?

– KReisser
7 hours ago















@KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

– JGH
6 hours ago







@KReisser no, you need to change FROM a,b to your layer names (FROM myLayer1, myLayer2) . SELECT a.name -> change name to your field name (SELECT a.myField nameA ...) (I have updated the sample code)

– JGH
6 hours ago















2














Have a look at the refFunctions Plugin. It allows you to create a reference to another layer and you can specify the field you want to reference:



Setup:




  • Point layer named points with id and field1 fields

  • Polygon layer named poly with id field


to Create the label for the poly layer I used this:



concat("id", ' with other ID: ', geomcontains('points', 'id') ,' and name :' ,  geomcontains('points', 'field1'))


Where:




  • "id" is the ID field of poly

  • geomcontains is the function from refFunctions

  • 'points' references my points layer and

  • 'id' is the ID field of points


Be aware this creates problems when you have many features inside one feature of the other layer (see gif for reference)
enter image description here






share|improve this answer
























  • Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

    – KReisser
    5 hours ago
















2














Have a look at the refFunctions Plugin. It allows you to create a reference to another layer and you can specify the field you want to reference:



Setup:




  • Point layer named points with id and field1 fields

  • Polygon layer named poly with id field


to Create the label for the poly layer I used this:



concat("id", ' with other ID: ', geomcontains('points', 'id') ,' and name :' ,  geomcontains('points', 'field1'))


Where:




  • "id" is the ID field of poly

  • geomcontains is the function from refFunctions

  • 'points' references my points layer and

  • 'id' is the ID field of points


Be aware this creates problems when you have many features inside one feature of the other layer (see gif for reference)
enter image description here






share|improve this answer
























  • Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

    – KReisser
    5 hours ago














2












2








2







Have a look at the refFunctions Plugin. It allows you to create a reference to another layer and you can specify the field you want to reference:



Setup:




  • Point layer named points with id and field1 fields

  • Polygon layer named poly with id field


to Create the label for the poly layer I used this:



concat("id", ' with other ID: ', geomcontains('points', 'id') ,' and name :' ,  geomcontains('points', 'field1'))


Where:




  • "id" is the ID field of poly

  • geomcontains is the function from refFunctions

  • 'points' references my points layer and

  • 'id' is the ID field of points


Be aware this creates problems when you have many features inside one feature of the other layer (see gif for reference)
enter image description here






share|improve this answer













Have a look at the refFunctions Plugin. It allows you to create a reference to another layer and you can specify the field you want to reference:



Setup:




  • Point layer named points with id and field1 fields

  • Polygon layer named poly with id field


to Create the label for the poly layer I used this:



concat("id", ' with other ID: ', geomcontains('points', 'id') ,' and name :' ,  geomcontains('points', 'field1'))


Where:




  • "id" is the ID field of poly

  • geomcontains is the function from refFunctions

  • 'points' references my points layer and

  • 'id' is the ID field of points


Be aware this creates problems when you have many features inside one feature of the other layer (see gif for reference)
enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 6 hours ago









LaughULaughU

3,19441232




3,19441232













  • Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

    – KReisser
    5 hours ago



















  • Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

    – KReisser
    5 hours ago

















Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

– KReisser
5 hours ago





Thank you, that seems helpful. But I need the label to be placed somewhere else, not on/near the feature, because it contains a lot of information. Usually I create a point-layer and link it to the layer with the values, where I create a point, the labels are displayed and are movable. But in this case I have two (or more) layers containing the requested values. Would that be possible with refFunctions?

– KReisser
5 hours ago










KReisser is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















KReisser is a new contributor. Be nice, and check out our Code of Conduct.













KReisser is a new contributor. Be nice, and check out our Code of Conduct.












KReisser is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f313464%2fhow-to-create-a-label-containing-values-from-different-layers-in-qgis%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Fairchild Swearingen Metro Inhaltsverzeichnis Geschichte | Innenausstattung | Nutzung | Zwischenfälle...

Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...

Marineschifffahrtleitung Inhaltsverzeichnis Geschichte | Heutige Organisation der NATO | Nationale und...