Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label that has data defined position is rendered even if it is outside the map canvas #42990

Closed
Forna73 opened this issue Apr 27, 2021 · 25 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers Labeling Related to QGIS map labeling stale Uh oh! Seems this work is abandoned, and the PR is about to close.

Comments

@Forna73
Copy link

Forna73 commented Apr 27, 2021

Hi!
I'm on QGis 3.16.6.
I'm sorry but I don't know how to classify this post, if a feature request, a bug or something else...
I'm using labels set in a way that their positions are determined by X,Y coordinates, because I need them in THAT position to avoid overlap with TENs of other labels (not included in the pic below to simplify the explanation of this behavior).
I created a map windows in Print Layout as you can see in A
A

If I shift the map windows content it could happens that some labels are outside the borders, and they should disappear from the map window bacause their X,Y position, but Qgis still shows them if the related geometry is still present in the map window, and put without even trying to prevent them from overlapping each other (LIP333 along North border, LIP88A, LIP88B along south border). and also in way it seems around the centroid of the visible polygon (LIR82 along East border, LIP3 along West border), all regardless of the chosen positioning mode (Horizontal, offset, etc...)
B

Is there a way to prevent this behavior? I'd like to let labels out of the map window if their positions aren't included. What is the use of setting coordinates if Qgis does what it wants?

@gioman gioman added the Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks label Apr 27, 2021
@gioman
Copy link
Contributor

gioman commented Apr 27, 2021

Is there a way to prevent this behavior? I'd like to let labels out of the map window if their positions aren't included. What is the use of setting coordinates if Qgis does what it wants?

@Forna73 please attach a sample project+sample data that can be used to replicate locally what you show here above.

@gioman gioman added the Feedback Waiting on the submitter for answers label Apr 27, 2021
@roya0045
Copy link
Contributor

@gioman This is quite a classic case, have any maps with data defined labels, when the coordinate of the label is outside of the canvas and the geometry is within, the label will use the center point but the callout line will remain.

@Forna73
Copy link
Author

Forna73 commented Apr 27, 2021

labels_along_borders.zip
Hope this help...

@Forna73
Copy link
Author

Forna73 commented Apr 28, 2021

It's seems like:
if Qgis could put the label where you want with your settings, it will does;
if Qgis couldn't do that, it will pick the label and put around the centroid of the visible portion of the element (this applys to point and line vectors too).
So it could be usable to have the possibility to choose this behavior, a check box or something that tells Qgis: what to do.
I mean:
if Qgis can draw the label as per your settings that's fine, but if it can't:

  1. let Qgis put the label where it wants
  2. don't show the label at all

@gioman gioman changed the title Labels along map borders Do not show the label if it outside the map cavas Apr 29, 2021
@gioman gioman added Map and Legend Related to map or legend rendering and removed Feedback Waiting on the submitter for answers labels Apr 29, 2021
@gioman gioman changed the title Do not show the label if it outside the map cavas Do not show the label if it is outside the map cavas Apr 29, 2021
@Forna73
Copy link
Author

Forna73 commented Apr 30, 2021

I just tested my files with old Qgis 3.10.8.... and it doesn't show this behavior.
So actually I think it's a bug, at least in 3.16.6

@gioman gioman added Bug Either a bug report, or a bug fix. Let's hope for the latter! and removed Feature Request labels May 1, 2021
@gioman
Copy link
Contributor

gioman commented May 1, 2021

I just tested my files with old Qgis 3.10.8.... and it doesn't show this behavior.
So actually I think it's a bug, at least in 3.16.6

@Forna73 I'm getting the expected result by disabling "show all labels for this layer (including colliding labels)". Please try.

@gioman gioman added the Feedback Waiting on the submitter for answers label May 1, 2021
@Forna73
Copy link
Author

Forna73 commented May 1, 2021

I can't do that, because in that way qgis doesn't show labels that I need.
The problem is that even a minimal part of geometry (1mm) in the map windows let Qgis put the label I don't need.... and this is making a lot of confusion... I'm having several labels I don't need only cause a minimal geometry portion.... and there's no way to get out of them.
If a label is set with coordinate out of the map windows it MUST not shows up... Qgis 3.16.6 simply always force the label to appear even a minimal part of a geometry is included in the map windows and there is no way to prevent this.

@roya0045
Copy link
Contributor

roya0045 commented May 1, 2021

Use an expression to control label render if the option is too much.

@gioman
Copy link
Contributor

gioman commented May 1, 2021

it MUST not shows up

@Forna73 the change could have been introduced by design. I suggest you to raise the question on the developers mailing list.

@Forna73
Copy link
Author

Forna73 commented May 1, 2021

I don't know how to proceed....
Now I'm very busy to revert my file to old Qgis 3.10.8 because I really can't manage this behavior....

Use an expression to control label render if the option is too much.

Don't know how to do....

@gioman
Copy link
Contributor

gioman commented May 1, 2021

I don't know how to proceed....

@Forna73 https://lists.osgeo.org/mailman/listinfo/qgis-developer

@roya0045
Copy link
Contributor

roya0045 commented May 1, 2021

@gioman I think gis stackexchange would be a better place to search and ask to search and ask for such things. As it would benefit other users with this issue.

@gioman
Copy link
Contributor

gioman commented May 1, 2021

@gioman I think gis stackexchange would be a better place to search and ask to search and ask for such things. As it would benefit other users with this issue.

@roya0045 about the expression, yes. What I meant is that is better to write in the list to understand of the change was introduced by design.

@Forna73
Copy link
Author

Forna73 commented May 3, 2021

HI... I wrote to the mailing list and gis stackexchange.

I've also found this... I thinks it's related to this problem

https://qgis.org/en/site/forusers/visualchangelog314/index.html#feature-automatic-placement-of-labels-outside-polygons

I'm still trying to understand but I think that some kind of bug in this automatic behavior?
What do you think?

@gioman
Copy link
Contributor

gioman commented May 3, 2021

HI... I wrote to the mailing list

@Forna73 I have seen the message. Suggestion: next time describe the problem in the message rather than just linking the Github ticket, this would raise your chances that someone will answer you (not saying that no one will).

I've also found this... I thinks it's related to this problem

Your labels position is data defined, so that option(s) are likely to be ignored.

@gioman gioman changed the title Do not show the label if it is outside the map cavas Label that has data defined position is rendered even if it is outside the map canvas May 3, 2021
@gioman gioman added Labeling Related to QGIS map labeling and removed Map and Legend Related to map or legend rendering Feedback Waiting on the submitter for answers Print Layouts Related to QGIS Print Layouts, Atlas or Reporting frameworks labels May 3, 2021
@Forna73
Copy link
Author

Forna73 commented May 6, 2021

It seems nobody is interested in this problem...

@gioman
Copy link
Contributor

gioman commented May 6, 2021

It seems nobody is interested in this problem...

@Forna73 what you are expecting? if this is issue is blocking for your workflow you should think about hiring a dev that can fix it for you, unless you can propose a patch. And this is assuming that this change was not introduced by design (something I'm not really sure about).

@roya0045
Copy link
Contributor

roya0045 commented May 6, 2021

@gioman I think this is an intended fallback. This is why I think an expression would be adequate to bypass the fallback.

@gioman
Copy link
Contributor

gioman commented May 6, 2021

@gioman I think this is an intended fallback. This is why I think an expression would be adequate to bypass the fallback.

@roya0045 I agree.

@Forna73
Copy link
Author

Forna73 commented May 7, 2021

I think this is an intended fallback. This is why I think an expression would be adequate to bypass the fallback.

Can you give me any example?

@roya0045
Copy link
Contributor

roya0045 commented May 7, 2021

within(make_point("aux_x","aux_y"),@map_extent)

@Forna73
Copy link
Author

Forna73 commented May 12, 2021

mhm... i can't figure out how to apply such kind of expression... I'm not so good...

@lindacamathias
Copy link

how to apply the expression (sorry the screenshots are in german version but i hope it may still help someone..)

  1. Labelstyling -> choose rule-based
    image (4)

  2. double click on rule text to change it
    image (5)

  3. put expression in filter:
    image (6)

@gioman gioman added the Feedback Waiting on the submitter for answers label Dec 15, 2021
@github-actions
Copy link

The QGIS project highly values your report and would love to see it addressed. However, this issue has been left in feedback mode for the last 14 days and is being automatically marked as "stale".
If you would like to continue with this issue, please provide any missing information or answer any open questions. If you could resolve the issue yourself meanwhile, please leave a note for future readers with the same problem and close the issue.
In case you should have any uncertainty, please leave a comment and we will be happy to help you proceed with this issue.
If there is no further activity on this issue, it will be closed in a week.

@github-actions github-actions bot added the stale Uh oh! Seems this work is abandoned, and the PR is about to close. label Dec 30, 2021
@github-actions
Copy link

While we hate to see this happen, this issue has been automatically closed because it has not had any activity in the last 42 days despite being marked as feedback. If this issue should be reconsidered, please follow the guidelines in the previous comment and reopen this issue.
Or, if you have any further questions, there are also further support channels that can help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Feedback Waiting on the submitter for answers Labeling Related to QGIS map labeling stale Uh oh! Seems this work is abandoned, and the PR is about to close.
Projects
None yet
Development

No branches or pull requests

4 participants