[Users] Symbol in layer tree disappears when applying numberFormat in SLD

Bart van den Eijnden bartvde at osgis.nl
Sun Mar 6 20:53:11 CET 2011


Hi Andrew,

GeoServer returns an exception for the GetLegendGraphic request. So you should probably report this to the Geoserver list.

Example request:
http://saturn.nmt.edu/geoserver/wms?&SINGLETILE=true&TRANSPARENT=true&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=national%3Ausgsdtw&SCALE=433344.0163321681&FORMAT=image%2Fgif

Error message returned:
java.lang.IllegalArgumentException: Cannot format given Object as a Number
Cannot format given Object as a Number

In the meanwhile, if you don't have any symbology that really changes with map scale, you could disable scale dependent legend graphics in GeoExt, e.g. by setting:

GeoExt.WMSLegend.prototype.useScaleParameter = false;

Or by changing http://dev.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/lib/GeoExt.ux/widgets/tree/LayerTreeBuilder.js:

xtype: "gx_wmslegend"

to:

xtype: "gx_wmslegend",
useScaleParameter: false

Hope this helps.

Best regards,
Bart

-- 
Looking for flexible support on OpenLayers or GeoExt? Please check out http://www.osgis.nl/support.html

Bart van den Eijnden
OSGIS
bartvde at osgis.nl

On Mar 6, 2011, at 7:50 PM, Andrew Parker wrote:

> The Geoserver list may be better to post this too.  However, I through 
> the geoext list will have a better understanding of the tree-builder 
> functionality.
> 
> I used the tree-builder.js code from 
> http://dev.geoext.org/sandbox/mapgears/geoext.ux/ux/LayerTreeBuilder/examples/tree-builder.html.
> 
> And applied it to my application at 
> http://saturn.nmt.edu/tests/test.html.   All symbology in the layer tree 
> displays correctly until I zoom into the "USGS Gauging Stations>Depth to 
> water (ft)" layer until the labels display in the map.  When the labels 
> display the symbology in the tree disappears.  This only happens when I 
> apply formatting in the Geoserver sld to limit the decimal places to 
> one, as follows:
> 
> <Label>
> <ogc:Function name="numberFormat">
> <ogc:Literal>#.#</ogc:Literal>
> <ogc:PropertyName>lev_va</ogc:PropertyName>
> </ogc:Function>
> </Label>
> 
> If I remove the numberFormat portion:
> 
> <Label>
> <ogc:PropertyName>lev_va</ogc:PropertyName>
> </Label>
> the layer tree symbol displays properly.  However, the label displays 
> all decimal places.
> 
> Does anyone know how to correct this issue or is it recommend that I 
> format the PostGIS data to one decimal place?
> 
> Thanks,
> 
> -- 
> Andrew Parker
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
> 



More information about the Users mailing list