[Geoserver-users] followline doesn't show all labels

Hi!

I'm experiencing that followline is not showing all of the labels that I
have on the dataset. I have a line-layer(roads) with roadnames. If I write
the SLD with a followline constraint the number of labels a clearly reduced.

I've tried to resolve it by reducing the font-size and changing font, but
the labels are still not appearing on all roads. Here is a piece of the
SLD-code:

<TextSymbolizer>
            <Label>
              <ogc:PropertyName>namn</ogc:PropertyName>
            </Label>
            
              <CssParameter name="font-family">SansSerif</CssParameter>
              <CssParameter name="font-size">8</CssParameter>
            
            <Halo>
              <Radius><ogc:Literal>1</ogc:Literal></Radius>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
                <CssParameter name="fill-opacity">0.85</CssParameter>
              </Fill>
            </Halo>
            
            <LabelPlacement>
              <LinePlacement>
              </LinePlacement>
            </LabelPlacement>
            
            <VendorOption name="followLine">true</VendorOption>
            <VendorOption name="labelAllGroup">false</VendorOption>
          </TextSymbolizer>

I have an example with followline and without.
<http://osgeo-org.1560.x6.nabble.com/file/n5070770/followlinefalse.png&gt;
<http://osgeo-org.1560.x6.nabble.com/file/n5070770/followlinetrue.png&gt;

Is this a correct behavior or does anybody have a workaround?

Best regards,
Lina

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/followline-doesn-t-show-all-labels-tp5070770.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I believe it’s normal behavior, in order to place a label with those options GeoServer:

  • places one label at the middle of the segment
  • places it only if it does not conflict with another label and
  • if there are no sharp turns in the line (> 40°)
  • the portion before and after the middle point is long enough to fit the whole label

To increase the change of labelling a line:

  • add a maxDisplacement
  • increase the max angle
  • if the lines are long enough, consider adding a repeat param too

See the labelling guide, from here onwards:
http://docs.geoserver.org/latest/en/user/styling/sld-reference/labeling.html#maxdisplacement

Cheers
Andrea

···

On Mon, Aug 5, 2013 at 9:21 AM, LinSta <lina.stahl@anonymised.com> wrote:

Hi!

I’m experiencing that followline is not showing all of the labels that I
have on the dataset. I have a line-layer(roads) with roadnames. If I write
the SLD with a followline constraint the number of labels a clearly reduced.

I’ve tried to resolve it by reducing the font-size and changing font, but
the labels are still not appearing on all roads. Here is a piece of the
SLD-code:

namn

SansSerif
8

1 #FFFFFF 0.85

true
false

I have an example with followline and without.
<http://osgeo-org.1560.x6.nabble.com/file/n5070770/followlinefalse.png>
<http://osgeo-org.1560.x6.nabble.com/file/n5070770/followlinetrue.png>

Is this a correct behavior or does anybody have a workaround?

Best regards,
Lina


View this message in context: http://osgeo-org.1560.x6.nabble.com/followline-doesn-t-show-all-labels-tp5070770.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
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


Thanks for the quick reply, I'll try these options as well!

All the best,
Lina

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/followline-doesn-t-show-all-labels-tp5070770p5070776.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

  • the portion before and after the middle point is long enough to fit the whole label

That’s the one that get’s me. My lines are text points that have been converted to lines in the loading process (GIS’s handle them better) - unfortunately when this parameter is enabled GeoServer refuses to render text if it is longer than the line (common with larger text sizes or when zoomed out).

However, even with followLine=false, the text still follows the line and doesn’t disappear. But again, my use-case is lines that are designed for text. Not sure if that’ll do it for you.

Jonathan

···

On Mon, Aug 5, 2013 at 9:21 AM, LinSta <lina.stahl@anonymised.com> wrote:

Hi!

I’m experiencing that followline is not showing all of the labels that I
have on the dataset. I have a line-layer(roads) with roadnames. If I write
the SLD with a followline constraint the number of labels a clearly reduced.

I’ve tried to resolve it by reducing the font-size and changing font, but
the labels are still not appearing on all roads. Here is a piece of the
SLD-code:

namn

SansSerif
8

1 #FFFFFF 0.85

true
false

I have an example with followline and without.
<http://osgeo-org.1560.x6.nabble.com/file/n5070770/followlinefalse.png>
<http://osgeo-org.1560.x6.nabble.com/file/n5070770/followlinetrue.png>

Is this a correct behavior or does anybody have a workaround?

Best regards,
Lina


View this message in context: http://osgeo-org.1560.x6.nabble.com/followline-doesn-t-show-all-labels-tp5070770.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


Get your SQL database under version control now!
Version control is standard for application code, but databases havent
caught up. So what steps can you take to put your SQL databases under
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk


Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

==
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 Mon, Aug 5, 2013 at 12:09 PM, Jonathan Moules <
jonathanmoules@anonymised.com> wrote:

However, even with followLine=false, the text still follows the line and
doesn't disappear. But again, my use-case is lines that are designed for
text. Not sure if that'll do it for you.

The default behavior with a LinePlacement is to put the text tangent to the
line, at this point we don't need the line anymore, we already have the
direction.
With followLine we actually follow the line shape, curving along it, so we
need a line to follow, if it's not long enough, we cannot place the label.
As an improvement, we could simply expand the line along the tangent to its
begin and end segments, but we don't have the code to do that right now.
Not even sure it's desirable, if a line is too short to contain its name,
better leave it not labelled imho, otherwise we might end up having
super-small
lines being drawn and their label sucking a lot of space and preventing
longer lines to be labelled (the moment we go out of the line the chance of
collisions increases a lot)

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

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

Hi Andrea,
Thanks for the clarification. In that case the followLine=false would be optimal for our use-case scenario (and in practice it seems to be too).

I updated the docs with this straight-line behaviour as a note.
Cheers,
Jonathan

···

However, even with followLine=false, the text still follows the line and doesn’t disappear. But again, my use-case is lines that are designed for text. Not sure if that’ll do it for you.

The default behavior with a LinePlacement is to put the text tangent to the line, at this point we don’t need the line anymore, we already have the direction.
With followLine we actually follow the line shape, curving along it, so we need a line to follow, if it’s not long enough, we cannot place the label.
As an improvement, we could simply expand the line along the tangent to its begin and end segments, but we don’t have the code to do that right now.
Not even sure it’s desirable, if a line is too short to contain its name, better leave it not labelled imho, otherwise we might end up having super-small
lines being drawn and their label sucking a lot of space and preventing longer lines to be labelled (the moment we go out of the line the chance of
collisions increases a lot)

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