[Geoserver-users] Tiled WMS layer labeling: speed / partial labels on tile

I am busy setting up GeoServer for tiled WMS layers.

I am running Windows Server 2012, PostgeSQL 9.4, PostGIS 2.2, Tomcat 8.0.9,
Java JRE 1.8.0.65 and Geoserver 2.8 with the CSS Styling extension.

While I have got most of my layers and styling sorted and rendering at a
reasonable speed, I am having issues with the 1 overlay that draws parcel
outlines and labels them.
. Each parcel has a street number.
. Some parcels also have a name, in which case the name is displayed instead
of the street number (label created in view).
. In the syle sheet I set -gt-label-auto-wrap.

/Attempt 1:/ default labeling:
Multiple labels on parcels cut by tiles

/Attempt 2:/ Add: label-geometry: [centroid(geom)]
No labels on parcels where the centroid is close to tile boundary

/Attempt 3:/ Manually edit generated SLD, add <sld:VendorOption
name="partials">true</sld:VendorOption>
Great improvement. Short labels render over both tiles.
Longer labels (may or may not go onto multiple lines) sometimes only render
on 1 tile leaving part of the label missing.

The image below is a partial screen shoot using FireBug to show a tile
boundary in blue and the red numbers added manualy for explanation.

<http://osgeo-org.1560.x6.nabble.com/file/n5235216/geoserver_labeling.png&gt;

1. Label should read: SIDMOR COUR*T*
2. Label should read: *K*ENHAR COURT
3. Label should read: MORTIM*ER* GARDE*NS*
4. Label should read: *T*WILLEY *G*ARDENS
5. The numbers 1, 2 & 3 render properly over 2 tiles. This is also the case
when cut vertically.

*Question 1:* Is there a solution to these labels only rendering on 1 tile?

/Attempt 4:/ Trying to get better label positions on pan-handle type
parcels, I added and pre-populated a second geometry column, "label_point"
using the following SQL:
UPDATE parcel
SET label_point =
    CASE
        WHEN ST_Contains(geom, ST_Centroid(geom)) THEN ST_Centroid(geom)
        ELSE ST_PointOnSurface(geom)
    END;

After much experimenting, and going as far as splitting the original
"parcel" layer into a "parcel_boundary" and "parcel_label" layer and
grouping them I have found huge speed differences between using
"label-geometry: [centroid(geom)]" and "label-geometry: [label_point]". The
first, which would seem like more processing for Geoserver, renders a full
screen of my map in < 2s. The second takes +- 45s to render a similar screen
of the map!

*Question 2:*
Why would supplying a point for the label take over 20x longer to render
than letting Geoserver calculate the centroid of a polygon?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I am also getting label (halo) artifacts occuring at the top-left of each
tile in some areas. This only happens at one zoom level. Zooming in or out
the image is correct.

<http://osgeo-org.1560.x6.nabble.com/file/n5235415/geoserver-halo.png&gt;

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216p5235415.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hi Derek,
I don’t think there is any quick solution to your issue, labels crossing the
tiles are either not painted, and you ensure that there is none cut, or
you allow partials, but at the risk of them being cut.

I don’t know of any way to make cut labels disappear for good in a tiled
map in partial mode, but I believe there are some ways to make them less
likely.
The first thing would be to increase the rendering buffer in the layer configuration so that GeoServer looks for geometries that are “far” away from the
current tile, but whose label gets into the tile. See http://docs.geoserver.org/latest/en/user/webadmin/data/layers.html#wms-settings

In case you still have cut labels, they are likely due to conflicts, a label inside the tile gets drawn and uses some of the space that the cut
label would use, making conflict resolution not paint the cut label.
If you can live with overlapping labels you can disable conflict resolution, there is a vendor param for that.

Otherwise, one could modify the code so that labels crossing the requested area get a significant priority bump and gets drawn first… tricky and
expensive, we’d have to first lay out all labels to find the crossing ones, then re-prioritize them, and draw them for good… but
it should work.

About the slowness for the points… I have no idea! Some analysis would be required, if you can develop you
can attach a profiler to you GeoServer while it’s labelling and see where the time is spent, and report back

Cheers
Andrea

···

On Mon, Nov 9, 2015 at 1:24 PM, Derek Watling <derek@anonymised.com> wrote:

I am busy setting up GeoServer for tiled WMS layers.

I am running Windows Server 2012, PostgeSQL 9.4, PostGIS 2.2, Tomcat 8.0.9,
Java JRE 1.8.0.65 and Geoserver 2.8 with the CSS Styling extension.

While I have got most of my layers and styling sorted and rendering at a
reasonable speed, I am having issues with the 1 overlay that draws parcel
outlines and labels them.
. Each parcel has a street number.
. Some parcels also have a name, in which case the name is displayed instead
of the street number (label created in view).
. In the syle sheet I set -gt-label-auto-wrap.

/Attempt 1:/ default labeling:
Multiple labels on parcels cut by tiles

/Attempt 2:/ Add: label-geometry: [centroid(geom)]
No labels on parcels where the centroid is close to tile boundary

/Attempt 3:/ Manually edit generated SLD, add <sld:VendorOption
name=“partials”>true</sld:VendorOption>
Great improvement. Short labels render over both tiles.
Longer labels (may or may not go onto multiple lines) sometimes only render
on 1 tile leaving part of the label missing.

The image below is a partial screen shoot using FireBug to show a tile
boundary in blue and the red numbers added manualy for explanation.

<http://osgeo-org.1560.x6.nabble.com/file/n5235216/geoserver_labeling.png>

  1. Label should read: SIDMOR COURT
  2. Label should read: KENHAR COURT
  3. Label should read: MORTIMER GARDENS
  4. Label should read: TWILLEY GARDENS
  5. The numbers 1, 2 & 3 render properly over 2 tiles. This is also the case
    when cut vertically.

Question 1: Is there a solution to these labels only rendering on 1 tile?

/Attempt 4:/ Trying to get better label positions on pan-handle type
parcels, I added and pre-populated a second geometry column, “label_point”
using the following SQL:
UPDATE parcel
SET label_point =
CASE
WHEN ST_Contains(geom, ST_Centroid(geom)) THEN ST_Centroid(geom)
ELSE ST_PointOnSurface(geom)
END;

After much experimenting, and going as far as splitting the original
“parcel” layer into a “parcel_boundary” and “parcel_label” layer and
grouping them I have found huge speed differences between using
“label-geometry: [centroid(geom)]” and “label-geometry: [label_point]”. The
first, which would seem like more processing for Geoserver, renders a full
screen of my map in < 2s. The second takes ± 45s to render a similar screen
of the map!

Question 2:
Why would supplying a point for the label take over 20x longer to render
than letting Geoserver calculate the centroid of a polygon?


View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216.html
Sent from the GeoServer - User mailing list archive at Nabble.com.


Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140


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

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V 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

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Thank you Andrea

I have set the rendering buffer to 256 (a full tile) on the layers that have
text labels, and at first look can't find any problem labels.

There does seem to be a slight performance hit, but still very usable. A
full screen of my map is now taking closer to 3s to render. Any advice on a
optimal setting?

I was hoping this might solve the "artifact" issue as well, but
unfortunately not.

I am still busy setting up the styling on our development server. Once I
move to the production server I will be using GeoWebCache with meta-tiling
which should also improve the labeling and speed.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216p5235441.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

On Tue, Nov 10, 2015 at 10:23 AM, Derek Watling <derek@anonymised.com> wrote:

There does seem to be a slight performance hit, but still very usable. A
full screen of my map is now taking closer to 3s to render. Any advice on a
optimal setting?

The normal set of advices is contained in this presentation:
http://www.slideshare.net/geosolutions/geoserver-on-steroids-foss4g-2015

I was hoping this might solve the "artifact" issue as well, but

unfortunately not.

You mean the halo one?

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V 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

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Thanks again, Andrea

I will go through the presentation.

Yes, the halo artifact is still appearing in some areas.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216p5235474.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Hey, were you ever able to solve the artifact problem with the partial labels
showing in the top left of each tile?

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216p5288143.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

I have solved the problem, but can’t remember a specific solution. Using
GeoWebCache now.

--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Tiled-WMS-layer-labeling-speed-partial-labels-on-tile-tp5235216p5288188.html
Sent from the GeoServer - User mailing list archive at Nabble.com.