Hello Jean-Philippe, On a different but related topic I found that WRAP parameter was not working as expected with a '|' while it was perfectly working with an '-'. Maybe you can try this instead of a '@'.
Nicol Am Samstag, den 28.03.2020, 11:42 -0400 schrieb Stephen Woodbridge: > On 3/28/2020 10:48 AM, Jean-Philippe Chenel wrote: > > Hi Steve, > > > > Using MapScript PHP API, WRAP is a integer member. > That sounds like it might be a bug in PHP API because in: > > https://mapserver.org/mapfile/label.html > > MAXLENGTH [ integer] > WARP [character] > > You might want to open a ticket and put in what you have tested. > I would also try making a trivial mapfile with a feature and label it > to > see that it works without the PHP mapscript > and then reproduce that in a simple PHP script to submit as examples > of > the issue. > > Hope this helps, > -Steve > > > I've also tried this, but the map isnt rendering. > > $labelObj->set("WRAP", "@"); > > > > Thank you very much for your help > > Jean-Philippe > > ----------------------------------------------------------------- > > ------- > > *De :* mapserver-users <[email protected]> de > > la > > part de Stephen Woodbridge <[email protected]> > > *Envoyé :* 28 mars 2020 10:43 > > *À :* [email protected] < > > [email protected]> > > *Objet :* Re: [mapserver-users] MapScript PHP label with > > expression > > and linebreak > > When labeling with linebreaks, I insert an unique character like > > '@', so > > "[field1]@[field2]" and then on the label block add > > WRAP "@" > > > > Try that and see if it works for you. > > > > -Steve W > > > > On 3/28/2020 10:22 AM, Jean-Philippe Chenel wrote: > > > Hi, > > > > > > Using MapScript PHP API, I want to create a label object (using > > > tostring expression) and put 2 columns with a linebreak between > > > them. > > > The example above is working well on a single line, but I don’t > > > know > > > how to make the linebreak (carriage return). > > > > > > $text = "(tostring([vol],'%.2f')+'[vol]')"; > > > $classObj = new classObj($layer); > > > $classObj->setText($text); > > > $classObj->addLabel(CreateNewLabel($labelProperties)); > > > > > > I've tried multiple combination of \r\n but none of them work > > > (map > > > rendering work, but the label completely disappear). > > > $text = "(tostring([vol],'%.2f') + '\r\n[vol]')"; > > > $text = "(tostring([vol],'%.2f') + '\r\n' + '[vol]')"; > > > > > > If I don’t use the expression, the line break work > > > $text = "'[vol]\r\n[vol]'"; > > > > > > By the way, the TEXT property is on the classObj, the setText > > > method > > > doesn’t work on the labelObj. > > > > > > With best regards, > > > > > > MapServer 7.4.4 (under ubuntu 16.04) > > > PHP 5.6.40 > > > > > > Jean-Philippe > > > > > > _______________________________________________ > > > mapserver-users mailing list > > > [email protected] > > > https://lists.osgeo.org/mailman/listinfo/mapserver-users > > > > _______________________________________________ > > mapserver-users mailing list > > [email protected] > > https://lists.osgeo.org/mailman/listinfo/mapserver-users > > _______________________________________________ > mapserver-users mailing list > [email protected] > https://lists.osgeo.org/mailman/listinfo/mapserver-users _______________________________________________ mapserver-users mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/mapserver-users
