Hi there,

I am having difficulty in retrieving a legend for a point layer.

Each point is labelled using 2 fields.  Both fields are numeric and the 
labels were being displayed like 1340.0/23.0 instead of 1340/23.

So I used the numberFormat function
====================================================
<sld:Label>
      <ogc:Function name="numberFormat">
        <ogc:Literal>#</ogc:Literal>
        <ogc:PropertyName>FILM_NO</ogc:PropertyName>
      </ogc:Function>
      /
      <ogc:Function name="numberFormat">
        <ogc:Literal>#</ogc:Literal>
        <ogc:PropertyName>NEG_NO</ogc:PropertyName>
      </ogc:Function>
<sld:Label>
====================================================

Using the Layer Preview option in the GeoServer web interface, I can view 
the layer fine and everything is labelled like 1340/23... perfect!

But if I try to retrieve the legend using the request:
http://localhost:8080/geoserver/wms?REQUEST=GetLegendGraphic&VERSION=1.0.0&FORMAT=image/png&WIDTH=20&HEIGHT=20&LAYER=LISTdata:Aerial_Photos&legend_options=forceLabels:on

I get the error:
java.lang.IllegalArgumentException: Filter Function problem for function 
strConcat argument #0 - expected type String
Filter Function problem for function strConcat argument #0 - expected type 
String

Out of curiosity I tried using just the one function:
====================================================
<sld:Label>
      <ogc:Function name="numberFormat">
        <ogc:Literal>#</ogc:Literal>
        <ogc:PropertyName>FILM_NO</ogc:PropertyName>
      </ogc:Function>
<sld:Label>
====================================================

and I got the error:
java.lang.IllegalArgumentException: Cannot format given Object as a Number
Cannot format given Object as a Number

If I remove the numberFormat function all together I can retrieve the 
legend fine, but all my labels have ".0" attached to them.

Any ideas or directions to solve this small dilemma will be most 
appreciated!

Thanks,

Sonya
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to