[Geoserver-users] NewLine with CDATA and FolowLine vendor Option In SLD

Hello list,

I am styling line object with SLD and combining „newLine“( <![CDATA[]]>) and <VendorOption name="followLine">true</VendorOption> to label from property.

Property [V_SAVYB] value: 1xd500 PE; 2xd200 PVC; 3xd50 PDHE

I replace “;” with newline symbol.

Here it is my SLD:

<sld:Label>
 <ogc:Function name="strReplace">
  <ogc:PropertyName>V_SAVYB</ogc:PropertyName>
  <ogc:Literal>;</ogc:Literal> 
  <ogc:Literal><![CDATA[
]]></ogc:Literal> 
  <ogc:Literal>true</ogc:Literal>
 </ogc:Function>
</sld:Label>
...
<VendorOption name="followLine">true</VendorOption>


Looks like “followLine” vendor option destroys generated multiline label and all text is rendered in one line following line object. If I comment out vendor option – multilabel are generated and rendered but not following the line.

is such behavior normal or it is a bug?

Sincarely,

Paul

On Mon, Oct 14, 2013 at 2:15 PM, Paulius Litvinas <paulius@anonymised.com>wrote:

Hello list,****

** **

I am styling line object with SLD and combining „newLine“( <![CDATA]>) and <VendorOption name="followLine">true</VendorOption> to label from property.****

** **

Property [V_SAVYB] value: 1xd500 PE; 2xd200 PVC; 3xd50 PDHE****

** **

I replace “;” with newline symbol.****

** **

Here it is my SLD:****

** **

<sld:Label>****

<ogc:Function name="strReplace">
  <ogc:PropertyName>V_SAVYB</ogc:PropertyName>
  <ogc:Literal>;</ogc:Literal>
  <ogc:Literal><![CDATA[
]]></ogc:Literal>
  <ogc:Literal>true</ogc:Literal>
</ogc:Function>****

</sld:Label>****

...****

<VendorOption name="followLine">true</VendorOption>****

** **

** **

Looks like “followLine” vendor option destroys generated multiline label and all text is rendered in one line following line object. If I comment out vendor option – multilabel are generated and rendered but not following the line.****

** **

is such behavior normal or it is a bug?

It is "normal", in that we don't have the ability to create multiline
labels with followline = true.
Adding this ability is not going to be trivial, but if you can write java
code and are are interested
I can show you where the code would have to be modified (or you can look
into commercial
support in case you want someone else to develop it for you)

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------

Thank you for the replay. Looks like to achieve the result I wanted is posible in other way. There was some mess in my SLD for label placement.

It just needed proper label placement with perpendicular offset:

sld:LabelPlacement


0.5


</sld:LabelPlacement>

Thanks again,

Paul

From: andrea.aime@anonymised.com [mailto:andrea.aime@anonymised.com] On Behalf Of Andrea Aime
Sent: Monday, October 14, 2013 3:25 PM
To: Paulius Litvinas
Cc: GeoServer Mailing List List
Subject: Re: [Geoserver-users] NewLine with CDATA and FolowLine vendor Option In SLD

On Mon, Oct 14, 2013 at 2:15 PM, Paulius Litvinas <paulius@anonymised.com> wrote:

Hello list,

I am styling line object with SLD and combining „newLine“( <![CDATA[]]>) and <VendorOption name="followLine">true</VendorOption> to label from property.
 
Property [V_SAVYB] value: 1xd500 PE; 2xd200 PVC; 3xd50 PDHE
 
I replace “;” with newline symbol.
 
Here it is my SLD:
 
<sld:Label>
 <ogc:Function name="strReplace">

  <ogc:PropertyName>V_SAVYB</ogc:PropertyName>

  <ogc:Literal>;</ogc:Literal> 

  <ogc:Literal><![CDATA[
]]></ogc:Literal> 

  <ogc:Literal>true</ogc:Literal>

 </ogc:Function>
</sld:Label>
...
<VendorOption name="followLine">true</VendorOption>
 
 
Looks like “followLine” vendor option destroys generated multiline label and all text is rendered in one line following line object. If I comment out vendor option – multilabel are generated and rendered but not following the line.
 
is such behavior normal or it is a bug?

It is “normal”, in that we don’t have the ability to create multiline labels with followline = true.

Adding this ability is not going to be trivial, but if you can write java code and are are interested

I can show you where the code would have to be modified (or you can look into commercial

support in case you want someone else to develop it for you)

Cheers

Andrea

==

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information.

==

Ing. Andrea Aime

@geowolf

Technical Lead

GeoSolutions S.A.S.

Via Poggio alle Viti 1187

55054 Massarosa (LU)

Italy

phone: +39 0584 962313

fax: +39 0584 1660272

mob: +39 339 8844549

http://www.geo-solutions.it

http://twitter.com/geosolutions_it


On Tue, Oct 15, 2013 at 7:49 AM, Paulius Litvinas <paulius@anonymised.com>wrote:

Thank you for the replay. Looks like to achieve the result I wanted is
posible in other way. There was some mess in my SLD for label placement.**
**

** **

It just needed proper label placement with perpendicular offset:****

** **

          <sld:LabelPlacement>
            <LinePlacement>
              <PerpendicularOffset>
                0.5
              </PerpendicularOffset>
            </LinePlacement>
          </sld:LabelPlacement>

Ah, you must have straight lines then, for curved lines it won't work
properly (that is, the label will
not follow the shape of the road)

Cheers
Andrea

--

Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------