Labeling using 'wordwrap' and 'wrap on character' with mutiple fields in QGIS?
up vote
3
down vote
favorite
I'm having a problem with multi-field labeling both using the 'wordwrap' function and the 'wrap on character' mode. In fact I would need to use the multiline mode only on the second of the two fields (setting the wrap_lenght to optimize the number of lines) but I have not succeeded in any way.
in the first image, on the left the correct formatting, on the right the formatting that I would like to correct but avoiding too many lines as on the right in the second image. The "number" is the first field while the "name" the second field.
I tried to solve the problem using the expression:
"FIELD_1" || '' || wordwrap ("FIELD_2", 12)
without changes in formatting,
and also using a rule based labeling with:
"FIELD_1" || ''
'' || wordwrap ("FIELD_2", 12)
but completely losing the formatting.
Is it possible to solve this problem?
qgis labeling
add a comment |
up vote
3
down vote
favorite
I'm having a problem with multi-field labeling both using the 'wordwrap' function and the 'wrap on character' mode. In fact I would need to use the multiline mode only on the second of the two fields (setting the wrap_lenght to optimize the number of lines) but I have not succeeded in any way.
in the first image, on the left the correct formatting, on the right the formatting that I would like to correct but avoiding too many lines as on the right in the second image. The "number" is the first field while the "name" the second field.
I tried to solve the problem using the expression:
"FIELD_1" || '' || wordwrap ("FIELD_2", 12)
without changes in formatting,
and also using a rule based labeling with:
"FIELD_1" || ''
'' || wordwrap ("FIELD_2", 12)
but completely losing the formatting.
Is it possible to solve this problem?
qgis labeling
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I'm having a problem with multi-field labeling both using the 'wordwrap' function and the 'wrap on character' mode. In fact I would need to use the multiline mode only on the second of the two fields (setting the wrap_lenght to optimize the number of lines) but I have not succeeded in any way.
in the first image, on the left the correct formatting, on the right the formatting that I would like to correct but avoiding too many lines as on the right in the second image. The "number" is the first field while the "name" the second field.
I tried to solve the problem using the expression:
"FIELD_1" || '' || wordwrap ("FIELD_2", 12)
without changes in formatting,
and also using a rule based labeling with:
"FIELD_1" || ''
'' || wordwrap ("FIELD_2", 12)
but completely losing the formatting.
Is it possible to solve this problem?
qgis labeling
I'm having a problem with multi-field labeling both using the 'wordwrap' function and the 'wrap on character' mode. In fact I would need to use the multiline mode only on the second of the two fields (setting the wrap_lenght to optimize the number of lines) but I have not succeeded in any way.
in the first image, on the left the correct formatting, on the right the formatting that I would like to correct but avoiding too many lines as on the right in the second image. The "number" is the first field while the "name" the second field.
I tried to solve the problem using the expression:
"FIELD_1" || '' || wordwrap ("FIELD_2", 12)
without changes in formatting,
and also using a rule based labeling with:
"FIELD_1" || ''
'' || wordwrap ("FIELD_2", 12)
but completely losing the formatting.
Is it possible to solve this problem?
qgis labeling
qgis labeling
edited 1 hour ago
PolyGeo♦
52.9k1779237
52.9k1779237
asked 6 hours ago
Andrew-63
1288
1288
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
You can apply a condition to have more control on the labels if the length of text exceeds certain number of characters as follows:
case
when length("Field_2") < 6 then "Field_1" || 'n' || wordwrap("Field_2",6)
when length("Field_2") >= 6 then "Field_1" || 'n' || wordwrap("Field_2",12)
end
The numbers 6 and 10 are just an example, you need to adjust them based on your needs.
The output should look like this:
In the above examples the length of Smith County and Bob County are different but they stacked onto two lines based on the conditions above.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
You can apply a condition to have more control on the labels if the length of text exceeds certain number of characters as follows:
case
when length("Field_2") < 6 then "Field_1" || 'n' || wordwrap("Field_2",6)
when length("Field_2") >= 6 then "Field_1" || 'n' || wordwrap("Field_2",12)
end
The numbers 6 and 10 are just an example, you need to adjust them based on your needs.
The output should look like this:
In the above examples the length of Smith County and Bob County are different but they stacked onto two lines based on the conditions above.
add a comment |
up vote
2
down vote
You can apply a condition to have more control on the labels if the length of text exceeds certain number of characters as follows:
case
when length("Field_2") < 6 then "Field_1" || 'n' || wordwrap("Field_2",6)
when length("Field_2") >= 6 then "Field_1" || 'n' || wordwrap("Field_2",12)
end
The numbers 6 and 10 are just an example, you need to adjust them based on your needs.
The output should look like this:
In the above examples the length of Smith County and Bob County are different but they stacked onto two lines based on the conditions above.
add a comment |
up vote
2
down vote
up vote
2
down vote
You can apply a condition to have more control on the labels if the length of text exceeds certain number of characters as follows:
case
when length("Field_2") < 6 then "Field_1" || 'n' || wordwrap("Field_2",6)
when length("Field_2") >= 6 then "Field_1" || 'n' || wordwrap("Field_2",12)
end
The numbers 6 and 10 are just an example, you need to adjust them based on your needs.
The output should look like this:
In the above examples the length of Smith County and Bob County are different but they stacked onto two lines based on the conditions above.
You can apply a condition to have more control on the labels if the length of text exceeds certain number of characters as follows:
case
when length("Field_2") < 6 then "Field_1" || 'n' || wordwrap("Field_2",6)
when length("Field_2") >= 6 then "Field_1" || 'n' || wordwrap("Field_2",12)
end
The numbers 6 and 10 are just an example, you need to adjust them based on your needs.
The output should look like this:
In the above examples the length of Smith County and Bob County are different but they stacked onto two lines based on the conditions above.
answered 2 hours ago
ahmadhanb
21.1k31850
21.1k31850
add a comment |
add a comment |
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f304680%2flabeling-using-wordwrap-and-wrap-on-character-with-mutiple-fields-in-qgis%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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