Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using the standalone GeoWebCache to serv tiles from a remote GeoServer. My problem is that the polygon label is added to each one of the tiles served, instead of only once in the polygon centroid.

I found a post which discusses the issue:

The first repley mentuned a possible solution:

"All in all, I suggest to use a tile rendering engine (GeoWebCache, MapProxy, TileCache) anyway, instead of requesting small image from GeoServer and have the tile rendering engine do the tile slicing afterwards. You will have send fewer requests to GeoServer (1 large image instead of multiple small images), so this speeds up the overall tile cache creation time."

Problem is that I couldn't find how to do that by reffering to the GeoWebCache documentation, and the above mentuned post doesn't explain the way to implement that.

I also found a post with an answer that links to the GeoWebCache "Tiled" documentation, but my code allready uses all the necessary attributes and still the label shows up multiple times:

var Layer_1874 = new OpenLayers.Layer.WMS(
    , {
        format: 'image/png',
        srs: 'EPSG:25832',
        layers: 'ballerupkommune_grundkort_bk',
        tiled: true,
        tilesOrigin: '698804,6173460'
    , {
        displayInLayerSwitcher: true,
        isBaseLayer: true,
        transitionEffect: 'resize',
        displayOutsideMaxExtent: true,
        visibility: false

Anyone has an idea?

Kind regards

share|improve this question
Can you show us the SLD file that you are using? That controls how labels are displayed on a WMS layer. – katahdin Oct 20 '12 at 20:28
up vote 11 down vote accepted

Below is an example of an SLD rule that places a label at the center of a feature's geometry. This uses the ogc:Function called "centroid" to place the label. You can read more about SLD functions in the GeoServer docs, and some examples are given here.

          <ogc:Function name="centroid">
          <sld:CssParameter name="font-family">Arial</sld:CssParameter>
          <sld:CssParameter name="font-size">11</sld:CssParameter>
          <sld:CssParameter name="font-style">normal</sld:CssParameter>
          <sld:CssParameter name="font-weight">bold</sld:CssParameter>
            <sld:CssParameter name="fill">#FFFFFF</sld:CssParameter>
        <sld:VendorOption name="conflictResolution">true</sld:VendorOption>
        <sld:VendorOption name="goodnessOfFit">0</sld:VendorOption>
        <sld:VendorOption name="autoWrap">60</sld:VendorOption>

Also, the SLD Cookbook is a great reference. One thing that can trip you up is the ordering of tags in the SLD. For the TextSymbolizer rule above you can see required order by looking in the schema definition. Don't worry, it's not too scary! Just search for "textsymbolizer" in that .xsd file, an you should easily find the "sequence" tag. There you'll find that the element references match up with the order in my example. (Note: I didn't use the text symbolizer's "fill" attribute, my fill just applies to the halo.)

share|improve this answer
Thanks @katahdin, that was great help. – Ambran Oct 22 '12 at 8:08
Feel free to accept the answer if it helped. Cheers! – katahdin Oct 22 '12 at 11:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.