<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Hi Steve,</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Using MapScript PHP API, WRAP is a integer member.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
I've also tried this, but the map isnt rendering.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
$labelObj->set("WRAP", "@");<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Thank you very much for your help</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
Jean-Philippe</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>De :</b> mapserver-users <mapserver-users-bounces@lists.osgeo.org> de la part de Stephen Woodbridge <stephenwoodbridge37@gmail.com><br>
<b>Envoyé :</b> 28 mars 2020 10:43<br>
<b>À :</b> mapserver-users@lists.osgeo.org <mapserver-users@lists.osgeo.org><br>
<b>Objet :</b> Re: [mapserver-users] MapScript PHP label with expression and linebreak</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">When labeling with linebreaks, I insert an unique character like '@', so
<br>
"[field1]@[field2]" and then on the label block add<br>
WRAP "@"<br>
<br>
Try that and see if it works for you.<br>
<br>
-Steve W<br>
<br>
On 3/28/2020 10:22 AM, Jean-Philippe Chenel wrote:<br>
> Hi,<br>
><br>
> Using MapScript PHP API, I want to create a label object (using <br>
> tostring expression) and put 2 columns with a linebreak between them.<br>
> The example above is working well on a single line, but I don’t know <br>
> how to make the linebreak (carriage return).<br>
><br>
> $text = "(tostring([vol],'%.2f')+'[vol]')";<br>
> $classObj = new classObj($layer);<br>
> $classObj->setText($text);<br>
> $classObj->addLabel(CreateNewLabel($labelProperties));<br>
><br>
> I've tried multiple combination of \r\n but none of them work (map <br>
> rendering work, but the label completely disappear).<br>
> $text = "(tostring([vol],'%.2f') + '\r\n[vol]')";<br>
> $text = "(tostring([vol],'%.2f') + '\r\n' + '[vol]')";<br>
><br>
> If I don’t use the expression, the line break work<br>
> $text = "'[vol]\r\n[vol]'";<br>
><br>
> By the way, the TEXT property is on the classObj, the setText method <br>
> doesn’t work on the labelObj.<br>
><br>
> With best regards,<br>
><br>
> MapServer 7.4.4 (under ubuntu 16.04)<br>
> PHP 5.6.40<br>
><br>
> Jean-Philippe<br>
><br>
> _______________________________________________<br>
> mapserver-users mailing list<br>
> mapserver-users@lists.osgeo.org<br>
> <a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br>
<br>
_______________________________________________<br>
mapserver-users mailing list<br>
mapserver-users@lists.osgeo.org<br>
<a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a></div>
</span></font></div>
</body>
</html>