qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.63k stars 3.01k forks source link

Wrong cartographic label alignment #53019

Open Tartamillo opened 1 year ago

Tartamillo commented 1 year ago

What is the bug or the crash?

When forcing some labels to 'TSL', 'TSR', 'BSL', 'BSR' I noticed that the right and left are reversed. image

Steps to reproduce the issue

Just open the attached project. Tested with 3.28 and 3.30 on Windows 10. debug label position.zip

Versions

QGIS version 3.30.2-'s-Hertogenbosch QGIS code revision 0992b533 Qt version 5.15.3 Python version 3.9.5 GDAL/OGR version 3.6.4 PROJ version 9.2.0 EPSG Registry database version v10.082 (2023-02-06) GEOS version 3.11.2-CAPI-1.17.2 SQLite version 3.41.1 PDAL version 2.5.2 PostgreSQL client version unknown SpatiaLite version 5.0.1 QWT version 6.1.6 QScintilla2 version 2.13.1 OS version Windows 10 Version 2009

Active Python plugins geometric_attributes 0.3 HCMGIS 23.2.1 joinmultiplelines Version 0.4.1 kmltools 3.1.28 layertilesmapcanvas 1.4 lockzoom 3.0.3 point_selection 0.5 ProcessX 1.5 quick_map_services 0.19.33 zoom_level 0.1 db_manager 0.1.20 grassprovider 2.12.99 processing 2.12.99

Supported QGIS version

New profile

Additional context

No response

YoannQDQ commented 1 year ago

How is that reversed? They look fine to me.

Tartamillo commented 1 year ago

To be consistent with T and TL, the TSL label should be slightly on the left of the point, like this: image

Instead it'is on the right side, like this image

YoannQDQ commented 1 year ago

Oh you're right. Didn't notice it.

nyalldawson commented 1 year ago

This is actually correct -- "top slightly left" means literally that the label will start slightly left of the point.

YoannQDQ commented 1 year ago

Shouldn't it be the mid point of the label that is either slightly left or slightly right though? Because right now, a TSL label more than four characters long is effectively slightly right, while a TSR one is slightly left... I agree with @Tartamillo, that does seem a bit strange.

nyalldawson commented 1 year ago

It may be a bit counter-intuitive, but there IS a logic to the naming and we can't possibly change the definition now without breaking projects.

Tartamillo commented 1 year ago

It is very counter-intuitive. But I don't see the logic, honestly. If I apply the above reasoning to TSR the label should start slightly to the right of the point, but it doesn't, it ends there. Here an example with a longer string. image

Breaking old projects is a very valid concern, but I've seen it happen before. Maybe the user could be warned when opening an old project that uses this kind of positioning.

nyalldawson commented 1 year ago

I'm -1000 to breaking old projects. We don't do that, ever.

Just read the string as "top, slightly to the right of the point" and it all makes logical sense. :)

Tartamillo commented 1 year ago

I distinctly remember having to rework a project because "meters at scale" didn't work as before, maybe it was an unintended side effect of some other change. But it doesn't matter, because you don't need to break anything. Keep the old values for backwards compatibility and deprecate them. Then add four new values, TJR, TJL, BJR, BJL, where "J" stands for "just" that work as a human being would expect them to.