[Geoserver-users] Repeating labels with tiles.

After a little research I found comments to other having this problem from Andrea and Mike and have determined that the issue I am experiencing with GeoServer 1.7.6 is related to GeoServer labeling a polygon multiple times when it extends multiple tiles from the built in GeoWebCache. The attached image shows the polygon outlined in black and the tiles in purple. This shows the label 4 times at the current zoom level. I have to ask, has anyone found a work around to this?

Charles Deaton

Repeat.png

After a little research I found comments to other having this problem from Andrea and Mike and have determined that the issue I am experiencing with GeoServer 1.7.6 is related to GeoServer labeling a polygon multiple times when it extends multiple tiles from the built in GeoWebCache. The attached image shows the polygon outlined in black and the tiles in purple. This shows the label 4 times at the current zoom level. I have to ask, has anyone found a work around to this?

Charles Deaton

Are you purposing two geometry values for a single shapefile? I can have our vendor add another value with the centroid of each polygon but I’m not seeing how one shapefile can show both the point and polygon.

From: Arne Kepp [mailto:arne@anonymised.com]
Sent: Monday, June 28, 2010 3:11 AM
To: Charles E. Deaton
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Repeating labels with tiles.

(I feel like we’ve been over this before?)

Calculate a point for each polygon, and assign the labels to the points instead of the polygons. So this is effectively a new layer, turn off the labeling of the old layer. Then configure GWC manually and add a “gutter” slightly bigger than the largest label (in pixels) if you want to get rid of all edge effects.

-Arne

On 6/25/10 6:54 PM, Charles E. Deaton wrote:

After a little research I found comments to other having this problem from Andrea and Mike and have determined that the issue I am experiencing with GeoServer 1.7.6 is related to GeoServer labeling a polygon multiple times when it extends multiple tiles from the built in GeoWebCache. The attached image shows the polygon outlined in black and the tiles in purple. This shows the label 4 times at the current zoom level. I have to ask, has anyone found a work around to this?

Charles Deaton

Are you purposing two geometry values for a single shapefile? I can have our vendor add another value with the centroid of each polygon but I’m not seeing how one shapefile can show both the point and polygon.

···

From: Arne Kepp [mailto:arne@anonymised.com]
Sent: Monday, June 28, 2010 3:11 AM
To: Charles E. Deaton
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Repeating labels with tiles.

(I feel like we’ve been over this before?)

Calculate a point for each polygon, and assign the labels to the points instead of the polygons. So this is effectively a new layer, turn off the labeling of the old layer. Then configure GWC manually and add a “gutter” slightly bigger than the largest label (in pixels) if you want to get rid of all edge effects.

-Arne

On 6/25/10 6:54 PM, Charles E. Deaton wrote:

After a little research I found comments to other having this problem from Andrea and Mike and have determined that the issue I am experiencing with GeoServer 1.7.6 is related to GeoServer labeling a polygon multiple times when it extends multiple tiles from the built in GeoWebCache. The attached image shows the polygon outlined in black and the tiles in purple. This shows the label 4 times at the current zoom level. I have to ask, has anyone found a work around to this?

Charles Deaton

On Mon, Jun 28, 2010 at 1:48 PM, Arne Kepp <arne@anonymised.com> wrote:

I'm saying you should create another shapefile (or move to Postgis and
create another table there). You could also code up an SLD extension that
only labels polygons at their centers.

Actually if you switch to PostGis then you can have the centroid as a
second geom column and use that for the text symbolizer.

I haven't actually tried it but
http://docs.geoserver.org/stable/en/user/styling/sld-tipstricks/mixed-geometries.html#restructuring-the-data
seems to indicate it is possible.

Ian
--
Ian Turton

Ian Turton ha scritto:

On Mon, Jun 28, 2010 at 1:48 PM, Arne Kepp <arne@anonymised.com> wrote:

I'm saying you should create another shapefile (or move to Postgis and
create another table there). You could also code up an SLD extension that
only labels polygons at their centers.

Actually if you switch to PostGis then you can have the centroid as a
second geom column and use that for the text symbolizer.

If you want to just settle for the centroid you can also use
the geometry transformations, there is a "centroid" function.

Mind, the centroid is not always the best labeling point, the labeler
has more sophisticated labeling behavior (especially in conjuction with
the maxDisplacement vendor options, which will make it look for
a free position in case the first candidate is busy. It used to
work only for lines, but now it works for polygon and points
too)

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Thanks again Arne.

So I would still need the polygon shapefile and add a second layer with the point and label those. I currently have the SLD to label the centers. I guess WMS being stateless it the whole issue.

Charlie

From: Arne Kepp [mailto:arne@anonymised.com]
Sent: Monday, June 28, 2010 1:48 PM
To: Charles E. Deaton
Cc: geoserver-users@lists.sourceforge.net
Subject: Re: [Geoserver-users] Repeating labels with tiles.

I’m saying you should create another shapefile (or move to Postgis and create another table there). You could also code up an SLD extension that only labels polygons at their centers.

WMS is stateless, so it doesn’t know whether a polygon was labeled in a previous request or not. The only way to avoid duplicates is to only have one (point) location for each

-Arne

On 06/28/2010 07:11 PM, Charles E. Deaton wrote:

Are you purposing two geometry values for a single shapefile? I can have our vendor add another value with the centroid of each polygon but I’m not seeing how one shapefile can show both the point and polygon.

From: Arne Kepp [mailto:arne@anonymised.com]
Sent: Monday, June 28, 2010 3:11 AM
To: Charles E. Deaton
Cc: geoserver-users@anonymised.comeforge.net
Subject: Re: [Geoserver-users] Repeating labels with tiles.

(I feel like we’ve been over this before?)

Calculate a point for each polygon, and assign the labels to the points instead of the polygons. So this is effectively a new layer, turn off the labeling of the old layer. Then configure GWC manually and add a “gutter” slightly bigger than the largest label (in pixels) if you want to get rid of all edge effects.

-Arne

On 6/25/10 6:54 PM, Charles E. Deaton wrote:

After a little research I found comments to other having this problem from Andrea and Mike and have determined that the issue I am experiencing with GeoServer 1.7.6 is related to GeoServer labeling a polygon multiple times when it extends multiple tiles from the built in GeoWebCache. The attached image shows the polygon outlined in black and the tiles in purple. This shows the label 4 times at the current zoom level. I have to ask, has anyone found a work around to this?

Charles Deaton