Hi,
what I've used before for generating per-request labels (the client
can choose what property should be used for a label) is something in
the line of
<Label>
<ogc:Function name="if_then_else">
<ogc:Function name="equalTo">
<ogc:Function name="env">
<ogc:Literal>label</ogc:Literal>
<ogc:Literal>_</ogc:Literal>
</ogc:Function>
<ogc:Literal>_</ogc:Literal>
</ogc:Function>
<!-- if no env:label parameter was supplied label by feature
ID. But could default to empty string instead? -->
<ogc:Function name="id">
</ogc:Function>
<!-- something was passed, if the property does not exist,
this will raise an exce-->
<ogc:Function name="property">
<ogc:Function name="env">
<ogc:Literal>label</ogc:Literal>
<ogc:Literal></ogc:Literal>
</ogc:Function>
</ogc:Function>
</ogc:Function>
</Label>
I hop this helps.
All the best,
tõnis
Kontakt am2222 (<[email protected]>) kirjutas kuupäeval R, 5. oktoober
2018 kell 09:53:
>
> Hi,
> I want to write an sld to be able to get lable field based on dynamic style.
> I tried this method
>
> <Label>
>
>
> <ogc:Function name="Recode">
>
> <ogc:Function name="env">
> <ogc:Literal>lable</ogc:Literal>
> <ogc:Literal>''</ogc:Literal>
> </ogc:Function>
>
> <ogc:Literal>flow</ogc:Literal>
> <ogc:PropertyName>flow</ogc:PropertyName>
>
> </ogc:Function>
>
>
> </Label>
>
> this works fine but I must add all possible fields into Recode function, Is
> there any better method to achieve this goal?
>
>
>
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/GeoServer-User-f3786390.html
>
>
> _______________________________________________
> 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
>
>
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
@tkardi
skype: tonis.kardi
_______________________________________________
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users