I have several Geoserver WMS layers styled with SLD. I also run GetFeatureInfo requests against those layers. My understanding is that Geoserver checks the layer's SLD rules even for GetFeatureInfo requests.

I'd like to be able to do string functions (for example StrReplace) on the attribute names to control how they are look when they are returned by GetFeatureInfo requests. For example if the column name is 'CONAME', I'd like the ability replace it with "County" using an SLD rule.

I could easily do this as well using the Freemarker templates or a Postgres view, but the we'd like to be able to frequently change these through the Geoserver web admin interface.

I can't find a good example of the complete syntax I need to make a rule like that and everything I've tried either doesn't validate or breaks the request.


While the getFeatureInfo requests do get checked against the current SLD that is only for the purposes of seeing what you clicked on. It allows users to click on points that are rendered with large symbols. So your style will have no impact on the names of the attributes.

Your only options are to use the FreeMarker templates (as you mention) or use an SQL view if you have a database-backed store.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.