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

Expressions for label rotation does no longer work #44475

Closed
raumregionmensch opened this issue Jul 30, 2021 · 4 comments · Fixed by #45279
Closed

Expressions for label rotation does no longer work #44475

raumregionmensch opened this issue Jul 30, 2021 · 4 comments · Fixed by #45279
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Labeling Related to QGIS map labeling Regression Something which used to work, but doesn't anymore

Comments

@raumregionmensch
Copy link

raumregionmensch commented Jul 30, 2021

What is the bug or the crash?

When using the 'Rotate label' tool, expressions for rotation are always replaced by auxiliary storage in QGIS 3.x. It seems there is no way to deactivate auxiliary storage for label rotation. Please see the attached screencasts for more information.

screencast_qgis_2_18_28.mp4
screencast_qgis_3_16_9.mp4

QGIS file:
label_rotation_expression.zip

Steps to reproduce the issue

Please open the attached .qgs file in QGIS 2.x and 3.x and follow the steps seen in the screencast.

Versions

3.16.9

Additional context

When opening the .qgis file in QGIS 3.16.9 'Label rotation' does automatically change from field rotation to expression 360-("rotation") for "type"=1 and from expression 180-"rotation" to expression 360-(180-"rotation") for "type"=2. This is quite strange. Is this a bug?

@raumregionmensch raumregionmensch added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Jul 30, 2021
@gioman gioman added Labeling Related to QGIS map labeling Feedback Waiting on the submitter for answers labels Jul 31, 2021
@nyalldawson
Copy link
Collaborator

When opening the .qgis file in QGIS 3.16.9 'Label rotation' does automatically change from field rotation to expression 360-("rotation") for "type"=1 and from expression 180-"rotation" to expression 360-(180-"rotation") for "type"=2. This is quite strange. Is this a bug?

This is by design. Qgis 2.x used the opposite direction for label rotation vs symbol rotation, which lead to much confusion. It was fixed in 3.0, but in order to maintain project appearance the label rotation will be updated to the "360-angle" expression you're seeing whenever you open a project saved in 2.x.

@raumregionmensch
Copy link
Author

Thanks for your reply. But why is it impossible to set an expression for label rotation?

screncast_qgis_3_16_9_label_rotation_expressions.mp4

@nyalldawson
Copy link
Collaborator

@raumregionmensch

But why is it impossible to set an expression for label rotation?

That's a bug

@gioman gioman removed the Feedback Waiting on the submitter for answers label Aug 4, 2021
@gioman gioman changed the title Expressions for label rotation does no longer work in QGIS 3.x Expressions for label rotation does no longer work Aug 4, 2021
@gioman gioman added the Regression Something which used to work, but doesn't anymore label Aug 4, 2021
@raumregionmensch
Copy link
Author

Perhaps this is a good moment to simplify some of our legacy QGIS 2 layer styles.

@nyalldawson nyalldawson self-assigned this Sep 27, 2021
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Sep 28, 2021
QgsAuxiliaryLayer::createProperty(*)

Instead, if a property already exists it will be upgraded to
an expression based property of the form:

    coalesce("new aux field", 'existing' || 'property' || 'expression')

(i.e. allow per-feature value overrides from the auxiliary field,
but by default fallback to the existing property definition)

Refs qgis#44475
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Sep 28, 2021
properties of the form coalesce("new aux field", 'some' || 'expression')

Refs qgis#44475
nyalldawson added a commit to nyalldawson/QGIS that referenced this issue Sep 28, 2021
an interactive map tool is used to move/rotate/edit labels

But instead automatically upgrade this property to use a

    coalesce("aux field", 'existing' || 'property' || 'expression')

type expression, so that the tool will place the interactively
edited position/rotation/etc in the auxiliary field but default
to using the expression for all other features

Fixes qgis#44475
nyalldawson added a commit that referenced this issue Sep 28, 2021
QgsAuxiliaryLayer::createProperty(*)

Instead, if a property already exists it will be upgraded to
an expression based property of the form:

    coalesce("new aux field", 'existing' || 'property' || 'expression')

(i.e. allow per-feature value overrides from the auxiliary field,
but by default fallback to the existing property definition)

Refs #44475
nyalldawson added a commit that referenced this issue Sep 28, 2021
properties of the form coalesce("new aux field", 'some' || 'expression')

Refs #44475
nyalldawson added a commit that referenced this issue Sep 28, 2021
an interactive map tool is used to move/rotate/edit labels

But instead automatically upgrade this property to use a

    coalesce("aux field", 'existing' || 'property' || 'expression')

type expression, so that the tool will place the interactively
edited position/rotation/etc in the auxiliary field but default
to using the expression for all other features

Fixes #44475
espinafre pushed a commit to espinafre/QGIS that referenced this issue Sep 29, 2021
QgsAuxiliaryLayer::createProperty(*)

Instead, if a property already exists it will be upgraded to
an expression based property of the form:

    coalesce("new aux field", 'existing' || 'property' || 'expression')

(i.e. allow per-feature value overrides from the auxiliary field,
but by default fallback to the existing property definition)

Refs qgis#44475
espinafre pushed a commit to espinafre/QGIS that referenced this issue Sep 29, 2021
properties of the form coalesce("new aux field", 'some' || 'expression')

Refs qgis#44475
espinafre pushed a commit to espinafre/QGIS that referenced this issue Sep 29, 2021
an interactive map tool is used to move/rotate/edit labels

But instead automatically upgrade this property to use a

    coalesce("aux field", 'existing' || 'property' || 'expression')

type expression, so that the tool will place the interactively
edited position/rotation/etc in the auxiliary field but default
to using the expression for all other features

Fixes qgis#44475
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! Labeling Related to QGIS map labeling Regression Something which used to work, but doesn't anymore
Projects
None yet
3 participants