[Geoserver-devel] labels along road curves

Hello All,

First of all, thanks to the Geoserver community for such a wonderful product. I have used Geoserver in my academic project and now I am using it at my workplace.

I am generating map tiles (this is my own java application & is not a part to geoserver), I am using geotools 2.5.2 found in geoserver-1.7.1/webapps/geoserver/WEB-INF/lib. I want the labels of road to appear along the road curve. I tried but did not get the expected results, they still come in a straight line.
I am using GraphicEnhancedMapContext as WMSMapContext is a part of Geoserver.

I have read http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/
Since I am not using Web.xml, I did
Map rendererParams = new HashMap();
rendererParams.put(StreamingRenderer.TEXT_RENDERING_KEY, StreamingRenderer.TEXT_RENDERING_OUTLINE);
renderer.setRendererHints(rendererParams);

Is this corrent?

I have added true to my SLD.

Can someone please tell me, how can I put the labels along the road path. How do I bring in the effect of
USE_NG_LABELLER
true through setting some class properties without using web.xml

Regards
Sagar

sagar arlekar ha scritto:

Hello All,

First of all, thanks to the Geoserver community for such a wonderful product. I have used Geoserver in my academic project and now I am using it at my workplace.

I am generating map tiles (this is my own java application & is not a part to geoserver), I am using geotools 2.5.2 found in geoserver-1.7.1/webapps/geoserver/WEB-INF/lib. I want the labels of road to appear along the road curve. I tried but did not get the expected results, they still come in a straight line.
I am using GraphicEnhancedMapContext as WMSMapContext is a part of Geoserver.

Why this change?

I have read http://blog.geoserver.org/2009/01/08/throw-geoserver-a-curve/
Since I am not using Web.xml, I did
        Map rendererParams = new HashMap();
        rendererParams.put(StreamingRenderer.TEXT_RENDERING_KEY, StreamingRenderer.TEXT_RENDERING_OUTLINE); renderer.setRendererHints(rendererParams);

Is this corrent?

Nope, this only changes the way fonts are rendered. This setting gives
text more aliasing and ensures it is perfectly centered with the eventual text halo (should you use it), but has nothing to do with
curved labels.

What you need is to setup a new label cache. In 1.7.1 the new labeller
is still part of the GeoServer sources, have a look at DefaultRasterMapProducer to see how it is setup. Anyways, it's something
like:

GSLabelCache labelCache = new GSLabelCache();
labelCache.setOutlineRenderingEnabled(true);
rendererParams.put(ShapefileRenderer.LABEL_CACHE_KEY, labelCache);

In 1.7.2 (current 1.7.x branch code if you have a snv checkout) the
labeller has been moved into geotools (2.5.x branch) under the
LabelCacheImpl name, and the setup is slightly different.

Hope this helps
Cheers
Andrea

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