Sorry folks, accidentally hit send on that too early. Here's the message I 
wanted to send:

Hello all,

I'm trying to make an SLD where a user can change the label field at runtime, 
but I'm running into problems getting the "property" function to work as 
expected with my data source. The source is producing complex features, and 
they show up in geoserver as namespaced. If I prefix a property with the 
namespace in <PropertyName>, everything works as expected, but when I try to 
use <Function name="property">, I hit errors.

A snippet like this works fine:
<Label>
  <ogc:PropertyName>namespace:myFeature</ogc:PropertyName>
</Label>

This fails with "The style specified an attribute named 'namespace:myFeature', 
not found in the 'namespace:layer' layer" (and similarly fails if I pass in a 
valid namespace-prefixed property name in the request):
<Label>
  <ogc:Function name="property">
    <ogc:Function name="env">
      <ogc:Literal>userDefinedLabel</ogc:Literal>
      <ogc:Literal>namespace:myFeature</ogc:Literal>
    </ogc:Function>
  </ogc:Function>
</Label>

I've tried a few different variations on the above (for example, removing 
prefixes or adding the full URL of the prefix) without success. The latter 
recipe also worked fine on a simple feature with no namespace, it's just the 
complex feature with the namespace that caused things to break. I've been 
digging through Google all day but have not found anything applicable to this 
scenario. I'd appreciate any suggestions that you all have on what I might be 
doing wrong here.

I am using GeoServer 2.17.3 with OpenJDK 1.8.0_272 Server running in a Linux 
container. I know, they're old - unfortunately upgrades to newer versions are 
not a priority right now.

Best,
Chris Reffett
________________________________
From: Reffett, Christopher <christopher.reff...@ga-ccri.com>
Sent: Monday, September 25, 2023 4:10 PM
To: geoserver-users@lists.sourceforge.net 
<geoserver-users@lists.sourceforge.net>
Subject: -EXT-[Geoserver-users] Trouble getting SLD property function to work 
with namespaced properties


WARNING:  This message is from an external source.  Evaluate the message 
carefully BEFORE clicking on links or opening attachments.

Hello all,

I'm trying to write an SLD but am having trouble getting the "property" 
function to work as expected. In short, I have a layer that has namespaced 
fields (it's coming from a data source that produces complex features) and am 
trying to make the label on those features able to be set by an env variable in 
a request.
This wor

I am using geoserver 2.17.3 - sorry, I know it's out of date, it'll be some 
time before we can update.
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to