Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I use GeoServer 2.1.1. and have an SLD to serve a layer with labels in OpenLayers. I noticed that some labels are not displayed because other labels are to near. GeoServer wants to make your labels look nice. Weird enough: I don't. Using the VendorOptions in the SLD I figured out some of the problems. I read the SLD cookbook. I am now using:

<TextSymbolizer>
 ...
 <VendorOption name="spaceAround">-1</VendorOption>
 <VendorOption name="conflictResolution">false</VendorOption>
 ...
</TextSymbolizer>

These two options makes GeoServer draw multiple labels on top of each other even though it will render the labels unreadable (which is what I require).

The problem that still remains is the positioning of the labels. I have the labels set to:

<LabelPlacement>
 <PointPlacement>
  <AnchorPoint>
   <AnchorPointX>0.5</AnchorPointX>
   <AnchorPointY>0.5</AnchorPointY>
  </AnchorPoint>
 </PointPlacement>
</LabelPlacement>

But as soon as the labels are to near of the edge of the image/bounds the it no longer centers the labels but will anchor it left or right depending on the position.

My question if someone knows how I can make GeoServer ignore trying to make it look so damn nice (I know it sounds weird!) and just let my labels run out of the image/bounds.

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

Check out GeoWebCache, the tile cache engine that comes with GeoServer. You can specify the gutter parameter. According to the docs:

"the gutter parameter is specified in pixels and represents extra padding around the image that is sliced away when the tiles are created. Certain WMS server have edge effects that can be eliminated this way, but it can also result in labels being cut off".

Particularly the last statement indicates this may solve your use case.

Another approach would be to simply request a larger image than the viewport of OpenLayers using the ratio parameter. Thus, labels that appear at the edge of the viewport are still labeled centered on their anchor location as there is still enough of the WMS map image that's simply not visible outside the OL viewport.

share|improve this answer
    
I just read some of the documentation on GeoWebCache. Your solutions seems a good fit. Only problem is that it would take a lot of time to rewrite the application to work with tiles. –  Ivo Limmen Jan 18 '12 at 8:42
    
Your other suggestion worked perfectly, thanks! –  Ivo Limmen Jan 18 '12 at 13:22
add comment

Your Answer

 
discard

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.