<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi all,</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
My name is Yoshimi, a company employee based in Nagoya, Japan. I'm not a core GIS developer, but I've run into an issue during a project and would appreciate any pointers from this community.</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'm running into an issue where <b>simple callout labels on LineString features fail to render at all when generated via a headless QGIS batch process (PyQGIS, Linux container)</b>, while the exact same
<code>.qml</code> style and the exact same data render the callouts correctly when loaded manually in QGIS Desktop.</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Environment:</b></div>
<ul style="text-align: left;">
<li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
QGIS Desktop version (works correctly): <b>3.28.0</b>, Windows</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
QGIS server/headless version (fails): <b>3.22</b> (Ubuntu 22.04 apt package, <code>qgis</code> + <code>python3-qgis</code>), running in a Docker container, driven via PyQGIS (<code>QgsApplication</code> headless, no GUI event loop)</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Data source: PostGIS, LineString geometry, EPSG:6677</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Output: PDF via <code>QgsLayoutExporter</code> (print layout export)</li></ul>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Label/callout configuration (rule-based labeling):</b></div>
<div class="elementToProof" style="margin: 8px 0px;">
<pre class="elementToProof" style="margin: 0px; padding: 8px; border-radius: 4px; max-width: 100%;"><div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: normal; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);"><code><placement priority="5" placementFlags="10" placement="6" dist="30"
overlapHandling="AllowOverlapIfRequired" .../>
<rendering unplacedVisibility="1" obstacle="0" .../>
<callout type="simple">
... anchorPoint="point_on_exterior" labelAnchorPoint="point_on_exterior"
minLength="0" offsetFromAnchor="0" offsetFromLabel="0" ...
</callout>
</code></div></pre>
</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Symptom:</b></div>
<ul style="text-align: left;">
<li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The line geometry itself renders correctly in the output PDF.</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The callout (leader line + label box) is completely absent in the batch/server output ¡X not partially clipped, not overlapping with anything, just not drawn at all.</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
No errors or warnings appear in the QGIS process log during style loading (<code>layer.loadNamedStyle()</code> returns success) or during layout export.</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Forcing <code>unplacedVisibility="1"</code> (always show, even if placement fails) made no difference.</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Changing <code>anchorPoint</code> from <code>pole_of_inaccessibility</code> to <code>point_on_exterior</code> made no difference.</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Ruled out: NULL/empty label field values (confirmed via logs), layer density/overlap competition (confirmed via an isolated manual test loading only the affected features), clipping at the map item's boundary edge.</li><li style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The same <code>.qml</code>, loaded onto the same features in QGIS Desktop 3.28.0, renders the callouts perfectly.</li></ul>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>Question:</b> Is there a known behavioral difference between QGIS 3.22 and 3.28 (or between interactive Desktop rendering and headless/server rendering via
<code>QgsLayoutExporter</code>) regarding callout placement for line geometries? Or any known issue/limitation with
<code>calloutType="simple"</code> specifically in non-interactive/headless rendering contexts?</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Any pointers on where to look (label engine internals, GEOS version dependency, changelog entries between 3.22 and 3.28 related to labeling/callouts, missing
<code>processEvents()</code> calls, etc.) would be greatly appreciated.</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; white-space: pre-wrap; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks, Yoshimi</div>
<div style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="text-align: left; text-indent: 0px; margin-top: 0.1em; margin-bottom: 0.2em; font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="margin: 8px 0px;"></div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>