The if_then_else function is a bit of a hack, and has corresponding test
functions (like equals()) that must be used with it instead of the normal
Filter elements (SLD disallows Filters as children of Expressions.)  See
this gist (including an SLD style and the CSS I used to generate it):
https://gist.github.com/dwins/5859628

Alternatively you could just have multiple rules representing the different
branches of the if-then-else tree.  That would look like this gist:
https://gist.github.com/dwins/5859680

Hope it helps.

--
David Winslow
OpenGeo - http://opengeo.org/


On Tue, Jun 25, 2013 at 11:46 AM, Jonathan Moules <
[email protected]> wrote:

> Hi List,
>   While waiting on an answer to my other thread, I decided to try and
> tackle the anchor problem. I came up with the following which, in theory at
> least, seems like it should work to get my se:AnchorPointY:
>
>
> Pseudocode version:
>
> If ANCHOR_PT == 0, 3 or 6
>>     return 0
>> else if ANCHOR_PT == 1, 4 or 7
>>     return 0.5
>> else
>>     return 1
>
>
>
>
> SLD version:
>
>
> <ogc:Function name="if_then_else">
>>  <ogc:Or>
>> <ogc:Function name="EqualTo">
>> <ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
>>  <ogc:Literal>0</ogc:Literal>
>> </ogc:Function>
>> <ogc:Function name="EqualTo">
>>  <ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
>> <ogc:Literal>3</ogc:Literal>
>>  </ogc:Function>
>> <ogc:Function name="EqualTo">
>> <ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
>>  <ogc:Literal>6</ogc:Literal>
>> </ogc:Function>
>> </ogc:Or>
>>     <ogc:Literal>0</ogc:Literal>
>> <ogc:Function name="if_then_else">
>> <ogc:Or>
>>  <ogc:Function name="EqualTo">
>> <ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
>>  <ogc:Literal>1</ogc:Literal>
>> </ogc:Function>
>> <ogc:Function name="EqualTo">
>>  <ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
>> <ogc:Literal>4</ogc:Literal>
>>  </ogc:Function>
>> <ogc:Function name="EqualTo">
>> <ogc:PropertyName>ANCHOR_PT</ogc:PropertyName>
>>  <ogc:Literal>7</ogc:Literal>
>> </ogc:Function>
>> </ogc:Or>
>>  <ogc:Literal>0.5</ogc:Literal>
>> <ogc:Literal>1</ogc:Literal>
>> </ogc:Function>
>> </ogc:Function>
>
>
>
>
> Unfortunately it's failing validation:
>
>
>    - Parsing failed for Or: java.lang.RuntimeException: Unable to find
>    function
>    - line 36: cvc-complex-type.2.4.a: Invalid content was found starting
>    with element 'ogc:Or'. One of '{"http://www.opengis.net/ogc":expression}'
>    is expected.
>    - line 37: cvc-complex-type.2.4.a: Invalid content was found starting
>    with element 'ogc:Function'. One of 
> '{"http://www.opengis.net/ogc":comparisonOps,
>    "http://www.opengis.net/ogc":spatialOps, 
> "http://www.opengis.net/ogc":logicOps}'
>    is expected.
>
>
> The "unable to find function" is particularly ominous though all
> referenced functions are in my wfs GetCapabilities.
>
> Anyone able to advise? What am I doing wrong?
> Thanks,
> Jonathan
>
> This transmission is intended for the named addressee(s) only and may
> contain sensitive or protectively marked material up to RESTRICTED and
> should be handled accordingly. Unless you are the named addressee (or
> authorised to receive it for the addressee) you may not copy or use it, or
> disclose it to anyone else. If you have received this transmission in error
> please notify the sender immediately. All email traffic sent to or from us,
> including without limitation all GCSX traffic, may be subject to recording
> and/or monitoring in accordance with relevant legislation.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> Geoserver-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
>
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to