https://issues.qgis.org/https://issues.qgis.org/favicon.ico2011-12-16T08:42:36ZQGIS Issue TrackingQGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=269362011-12-16T08:42:36ZPaolo Cavallinicavallini@faunalia.it
<ul><li><strong>Category</strong> changed from <i>Symbology</i> to <i>Labelling</i></li></ul> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=276832011-12-16T13:10:44ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Target version</strong> set to <i>Version 1.7.4</i></li></ul> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=310852012-04-16T04:29:34ZPaolo Cavallinicavallini@faunalia.it
<ul><li><strong>Target version</strong> changed from <i>Version 1.7.4</i> to <i>Version 1.8.0</i></li><li><strong>Affected QGIS version</strong> set to <i>master</i></li><li><strong>Crashes QGIS or corrupts data</strong> set to <i>No</i></li></ul> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=334952012-07-24T03:50:57ZLarry Shaffer
<ul></ul><p>Giovanni, the new Freeze/Thaw label tool will handle the need for populating the attribute tables with x, y and rotational label info. This allows for batch freezing of label properties to the table without using the Move Label tool on each label. The tool can also hide labels (set size to 0, if size is data-defined).</p>
<p>See: <a class="external" href="http://osgeo-org.1560.n6.nabble.com/New-adv-labeling-freeze-thaw-tools-td4988479.html">http://osgeo-org.1560.n6.nabble.com/New-adv-labeling-freeze-thaw-tools-td4988479.html</a></p>
<p>The Freeze/Thaw tool does not address the need for label rotation to be independent from x, y being defined.</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=335012012-07-24T08:55:21ZGerhard Spieles
<ul></ul><p>In the old labeling engine, it is possible to set the rotation field without having x and y fields in the attribute table. Only a field with the rotation infomation is necessary.</p>
<p>For practicle work, it would be good to have this functionality also in the new labeling engine.</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=335562012-07-28T07:09:04ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Larry Shaffer wrote:</p>
<blockquote>
<p>Giovanni, the new Freeze/Thaw label tool will handle the need for populating the attribute tables with x, y and rotational label info. This allows for batch freezing of label properties to the table without using the Move Label tool on each label. The tool can also hide labels (set size to 0, if size is data-defined).</p>
<p>See: <a class="external" href="http://osgeo-org.1560.n6.nabble.com/New-adv-labeling-freeze-thaw-tools-td4988479.html">http://osgeo-org.1560.n6.nabble.com/New-adv-labeling-freeze-thaw-tools-td4988479.html</a></p>
<p>The Freeze/Thaw tool does not address the need for label rotation to be independent from x, y being defined.</p>
</blockquote>
<p>Hi Larry,<br />thanks for your work.</p>
<p>Freezing the labels seems at least a good "workaround" to get those x/y columns populated and so the labels rotated.</p>
<p>I just gave it a try and I have a doubt: In a layer I set the x/y and rotation columns for labels. The latter one was already populated with the angle values for labels. I then pick the "freeze labels" tool and noticed that while it correctly populated the x/y columns then it changed the values in the rotation column to "0". This should be not be expected... or I am wrong?</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=336632012-08-02T07:56:14ZLarry Shaffer
<ul></ul><p>Giovanni,</p>
<p>Interesting. I had not anticipated such predefined rotation-only, though this issue certainly is concerned with that. What you are seeing is 'expected' behavior, only in that the Freeze/Thaw label tool is new and does one thing when freezing: writes the PAL solution to the mapped x, y and rotation columns.</p>
<p>The freezing part of the tool does not account for any preexisting, non-zero data in a field, but you can do so manually with this work around:</p>
<ol>
<li>Pre-populate your attribute table with desired horz. and vert. alignments.</li>
<li>Before freezing, map only x and y, and optionally horz. and vert. alignments, but <em>not</em> the rotation column. The x and y fields will be assumed to have Null values for this.</li>
<li>Freeze the labels. This will write data to x and y columns, but not to preexisting rotation column.</li>
<li>Map rotation column and apply. The labels should now rotate about desired point (relative to halign and valign).</li>
</ol>
<p>I have tested this with horizontal labels for a polygon vector layer with the following settings:</p>
<ul>
<li>Placement: Over centroid</li>
<li>Horz. align: Center</li>
<li>Vert. align: Half</li>
</ul>
<p>This resulted with labels frozen, then rotated about their middle to the data-defined value. This may in fact do what you are looking for, until rotation can be applied independent of x, y location.</p>
<p>I see two things that you may notice in different configurations:</p>
<ul>
<li>Not pre-populating your table with horz. and vert. alignments could lead to unexpected shifting of labels to new rotation points, if you apply those settings after freezing.</li>
<li>During step # 2, if there is any rotation in the PAL solution, it will 'disappear' upon freezing and the label will rotate to 0 around your defined point, since at that stage in the workaround there is no mapped rotation column. I recommend pre-populating your table with horz. and vert. alignments to make sure it un-rotates how you want.</li>
</ul>
<p>Please let me know if this works for you, and if not, what you particular labeling situation is - preferably by sharing some sample data.</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=336642012-08-02T08:24:20ZLarry Shaffer
<ul></ul><p>Giovanni,</p>
<p>Regarding your question:</p>
<blockquote>
<p>"The above is quite counter-intuitive and for polygons (and also lines I guess) it can almost be considered a bug because is not clear at all what coordinates should be used to fill the "X" and "Y" columns. ..."</p>
</blockquote>
<p>Unless I'm mistaken, the x, y location always refers to the rotation point of the label, whether from the PAL solution or data-defined. It has nothing to do with a feature's coordinates, excepting the fact that label placements <em>are derived</em> from the feature's geometry. This is one reason I made the Freeze/Thaw tool, to work directly with the label's derived location, not its feature. This is also the basis of how the other label manipulation tools work.</p>
<p>This means working with the horz. and vert. alignments will help you define how the label is shown, but not unless the label is data-defined (BTW, another issue, similar to independent rotation). The alignments are for the rotation point's placement <em>relative to the actual label itself</em>. This includes its font size and string length, which can lead to unexpected labeling changes if your label's text changes regularly and you use certain alignments.</p>
<p>The alignments are described here:<br /><a class="external" href="https://github.com/qgis/Quantum-GIS/blob/master/src/core/qgspallabeling.h#L83">https://github.com/qgis/Quantum-GIS/blob/master/src/core/qgspallabeling.h#L83</a></p>
<p>Yes, there needs to be more documentation on this. :^)</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=337442012-08-07T10:21:12ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Larry Shaffer wrote:</p>
<blockquote>
<p>Giovanni,</p>
<p>Interesting. I had not anticipated such predefined rotation-only, though this issue certainly is concerned with that. What you are seeing is 'expected' behavior, only in that the Freeze/Thaw label tool is new and does one thing when freezing: writes the PAL solution to the mapped x, y and rotation columns.</p>
<p>The freezing part of the tool does not account for any preexisting, non-zero data in a field, but you can do so manually with this work around:</p>
<ol>
<li>Pre-populate your attribute table with desired horz. and vert. alignments.</li>
<li>Before freezing, map only x and y, and optionally horz. and vert. alignments, but <em>not</em> the rotation column. The x and y fields will be assumed to have Null values for this.</li>
<li>Freeze the labels. This will write data to x and y columns, but not to preexisting rotation column.</li>
<li>Map rotation column and apply. The labels should now rotate about desired point (relative to halign and valign).</li>
</ol>
</blockquote>
<p>Hi Larry,</p>
<p>thanks for the extensive answer, I need to read carefully your notes but meanwhile I would answer to the above steps.</p>
<p>Not mapping the rotation field, freezing and then mapping the rotation field does the trick. But what about if the user mistakenly does map also the rotation field before freezing? The rotation column changes in an irreversible way (and the rotation values can take a long to be carefully computed) and so I would consider this a wrong behaviour and a "causes data corruption" issue. Do you agree?</p>
<p>cheers</p>
<p>-- Giovanni --</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=337452012-08-07T13:25:50ZLarry Shaffer
<ul></ul><p>Giovanni Manghi wrote:</p>
<blockquote>
<p>... But what about if the user mistakenly does map also the rotation field before freezing? The rotation column changes in an irreversible way (and the rotation values can take a long to be carefully computed) and so I would consider this a wrong behaviour and a "causes data corruption" issue. Do you agree?</p>
</blockquote>
<p>Yes. While not exactly corruption, definitely unintentional data loss, and possibly large if many labels are frozen. I think the following might work:</p>
<pre><code>A) Default for unfrozen labels (NULL in x, y, and rot [rotation] fields): x, y and rot PAL engine data is frozen</code></pre>
<pre><code>B) Default for unfrozen labels with preexisting rot data (NULL in x, y fields): only x, y PAL engine data is frozen</code></pre>
<p>Thawing a label is a bit more tricky since setting x, y and rot fields to NULL <em>should be the default</em>. Not setting the rot to NULL would mean the user couldn't set the rot field with new PAL data on a subsequent freeze because the PAL rot data would always be ignored, thereby defeating the interactivity and accuracy of the thawing feature.</p>
<p>It sounds like a layer-level preference along the lines of <strong>'Clear rotation values in thawing operations'</strong> is needed. That setting, when checked, would mean any thawing operation will write NULL to the rotation field (i.e. user hasn't predefined and doesn't care about the data loss). If checked, default B) above would still be in effect to prevent accidental preexisting data loss. Now, whether that setting should, by default, be checked or not might depend upon your needs and opinion.</p>
<p>Do you think that's a reasonable solution? I do. And I also think the setting should default to checked, since predefined rotation values will probably be less prevalent than the desire to freeze/thaw interactively with the PAL solutions.</p>
<p>Example of the setting checked: a user has a predefined rotation value, then freezes the label, they will <em>see</em> that rotation applied. When they thaw that label, they again <em>see the rotation is removed</em>, allowing them to undo or not commit the change(s).</p>
<p>I'd like to hear other ideas, though.</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=337662012-08-09T03:28:04ZGiovanni Manghigiovanni.manghi@gmail.com
<ul></ul><p>Hi Larry,</p>
<p>Larry Shaffer wrote:</p>
<blockquote>
<p>Giovanni Manghi wrote:</p>
<blockquote>
<p>... But what about if the user mistakenly does map also the rotation field before freezing? The rotation column changes in an irreversible way (and the rotation values can take a long to be carefully computed) and so I would consider this a wrong behaviour and a "causes data corruption" issue. Do you agree?</p>
</blockquote>
<p>Yes. While not exactly corruption, definitely unintentional data loss, and possibly large if many labels are frozen. I think the following might work:</p>
<p>A) Default for unfrozen labels (NULL in x, y, and rot [rotation] fields): x, y and rot PAL engine data is frozen</p>
<p>B) Default for unfrozen labels with preexisting rot data (NULL in x, y fields): only x, y PAL engine data is frozen</p>
<p>Thawing a label is a bit more tricky since setting x, y and rot fields to NULL <em>should be the default</em>. Not setting the rot to NULL would mean the user couldn't set the rot field with new PAL data on a subsequent freeze because the PAL rot data would always be ignored, thereby defeating the interactivity and accuracy of the thawing feature.</p>
<p>It sounds like a layer-level preference along the lines of <strong>'Clear rotation values in thawing operations'</strong> is needed. That setting, when checked, would mean any thawing operation will write NULL to the rotation field (i.e. user hasn't predefined and doesn't care about the data loss). If checked, default B) above would still be in effect to prevent accidental preexisting data loss. Now, whether that setting should, by default, be checked or not might depend upon your needs and opinion.</p>
<p>Do you think that's a reasonable solution? I do. And I also think the setting should default to checked, since predefined rotation values will probably be less prevalent than the desire to freeze/thaw interactively with the PAL solutions.</p>
</blockquote>
<p>yes it seems reasonable</p>
<blockquote>
<p>Example of the setting checked: a user has a predefined rotation value, then freezes the label, they will <em>see</em> that rotation applied. When they thaw that label, they again <em>see the rotation is removed</em>, allowing them to undo or not commit the change(s).</p>
<p>I'd like to hear other ideas, though.</p>
</blockquote>
<p>It seems to me that you already committed this changes into master, right? I will give it a try and leave feedback.</p>
<p>Thanks!</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=337702012-08-09T09:08:55ZLarry Shaffer
<ul></ul><p>Giovanni Manghi wrote:</p>
<blockquote>
<p>It seems to me that you already committed this changes into master, right? I will give it a try and leave feedback.</p>
</blockquote>
<p>Yes: <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/6cfb0604237244b1588c9fb66af961b1517f6c53" title="Option to preserve existing rotation values during freeze/thaw label operations - PAL layer sett...">6cfb0604237244b1588c9fb66af961b1517f6c53</a></p>
<p>After some testing, I decided upon using <strong>'Preserve existing rotation values during label freeze/thaw operations'</strong> for the PAL-layer setting and having it <strong>checked as default</strong>. Otherwise, accidental data loss was still possible, at least by the casual user who might not understand the defaults I outlined above (which aren't used now). Data loss or updates while using a tool should only be by user choice.</p>
<p>To make sure users who want the interactive rotation options of the freeze/thaw tool can configure it quickly, I placed the setting right under the mapping for the Rotation column in the Data-defined tab, rather than under a different tab.</p> QGIS Application - Bug report #4317: New labeling: rotation for polygons is only applied after moving the label + the "issue" of needing the "X" and "Y" columnshttps://issues.qgis.org/issues/4317?journal_id=338182012-08-13T02:30:14ZGiovanni Manghigiovanni.manghi@gmail.com
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li><li><strong>Resolution</strong> set to <i>fixed</i></li></ul><p>Larry Shaffer wrote:</p>
<blockquote>
<p>Giovanni Manghi wrote:</p>
<blockquote>
<p>It seems to me that you already committed this changes into master, right? I will give it a try and leave feedback.</p>
</blockquote>
<p>Yes: <a class="changeset" href="https://issues.qgis.org/projects/qgis/repository/revisions/6cfb0604237244b1588c9fb66af961b1517f6c53" title="Option to preserve existing rotation values during freeze/thaw label operations - PAL layer sett...">6cfb0604237244b1588c9fb66af961b1517f6c53</a></p>
<p>After some testing, I decided upon using <strong>'Preserve existing rotation values during label freeze/thaw operations'</strong> for the PAL-layer setting and having it <strong>checked as default</strong>. Otherwise, accidental data loss was still possible, at least by the casual user who might not understand the defaults I outlined above (which aren't used now). Data loss or updates while using a tool should only be by user choice.</p>
<p>To make sure users who want the interactive rotation options of the freeze/thaw tool can configure it quickly, I placed the setting right under the mapping for the Rotation column in the Data-defined tab, rather than under a different tab.</p>
</blockquote>
<p>Hi Larry!<br />I finally tested your latest work and it seems to me that it works pretty good. I guess that we will have anyway to describe well how it works in the user manual, because I guess that a casual user will expect anyway to see the labels rotated without needing the x/y columns and without needing to pin the label. Congrats for your work!</p>