Cannot access FID in SLD for Labels
-----------------------------------
Key: GEOS-3944
URL: http://jira.codehaus.org/browse/GEOS-3944
Project: GeoServer
Issue Type: Bug
Components: WMS
Affects Versions: 2.0.1
Reporter: J Smith
Assignee: Andrea Aime
As discussed on the geoserver-users list in a thread starting at http://thread.gmane.org/gmane.comp.gis.geoserver.user/21027 ...
I was wondering if there's any way to access a feature's FID in SLD in a text label. I've seen a handful of posts that suggest things like the following would work:
<Label>
<ogc:PropertyName>@gml:id</ogc:PropertyName>
</Label>
Or
<Label>
<ogc:Function name="id" />
</Label>
The Geotools source code notes that use of the ID function is deprecated in lieu of using @gml:id according to IDFunctionExpressionTest.java, though.
In either case, neither seems to be providing a usable label. In the case of using the PropertyName @gml:id, an exception is thrown from org.geoserver.wms.kvp.GetMapKvpRequestReader.checkStyle in GetMapKvpRequestReader.java saying that "The requested Style can not be used with this layer. The style specifies an attribute of @gml:id and the layer is WhateverLayer".
In the case of using ogc:Function, a java.lang.Object appears to be returned and stringified, resulting in a label like
"java.lang.Object@anonymised.com" and the like. Using strTrim or strConcat functions to coerce the Object into a String don't seem to do anything.
This may be either a bug or intentional behaviour, but as discussed in the thread, here's a ticket for the issue all the same.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira