Hi Fellows,
Do you guys know if it is possible to combine AND and OR filters ?
SQL Ej: (colA = 1 and colB = 2) or colC = 3
SLD Ej.:
ogc:Filter
ogc:And
ogc:PropertyIsEqualTo
ogc:PropertyNamecolA</ogc:PropertyName>
ogc:Literal1</ogc:Literal>
</ogc:PropertyIsEqualTo>
ogc:PropertyIsEqualTo
ogc:PropertyNamecolB </ogc:PropertyName>
ogc:Literal2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
ogc:Or
ogc:PropertyIsEqualTo
ogc:PropertyNamecolC</ogc:PropertyName>
ogc:Literal3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
Does this makes any sense ?
I have not tried it yet, just need something like this, and had no idea how to write it down.
Best regards
Ricardo
On Fri, Oct 15, 2010 at 10:30 AM, Ricardo Bayley
<ricardo.bayley@anonymised.com> wrote:
Hi Fellows,
Do you guys know if it is possible to combine AND and OR filters ?
SQL Ej: (colA = 1 and colB = 2) or colC = 3
SLD Ej.:
<ogc:Filter>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>colA</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>colB </ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>colC</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
Does this makes any sense ?
I have not tried it yet, just need something like this, and had no idea how
to write it down.
Something like
<ogc:Filter>
<ogc:Or>
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>colA</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>colB </ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>colC</ogc:PropertyName>
<ogc:Literal>3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
The Or filter must contain two filters so the And goes inside it.
Ian
--
Ian Turton
You can’t have multiple filters in one element. However, you can nest ORs and ANDs as deeply as you like.
ogc:Or
ogc:And
ogc:PropertyIsEqualTo
ogc:PropertyNamecolA</ogc:PropertyName>
ogc:Literal1</ogc:Literal>
</ogc:PropertyIsEqualTo>
ogc:PropertyIsEqualTo
ogc:PropertyNamecolB </ogc:PropertyName>
ogc:Literal2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
ogc:PropertyIsEqualTo
ogc:PropertyNamecolC</ogc:PropertyName>
ogc:Literal3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
On Fri, Oct 15, 2010 at 4:30 PM, Ricardo Bayley <ricardo.bayley@anonymised.com> wrote:
Hi Fellows,
Do you guys know if it is possible to combine AND and OR filters ?
SQL Ej: (colA = 1 and colB = 2) or colC = 3
SLD Ej.:
ogc:Filter
ogc:And
ogc:PropertyIsEqualTo
ogc:PropertyNamecolA</ogc:PropertyName>
ogc:Literal1</ogc:Literal>
</ogc:PropertyIsEqualTo>
ogc:PropertyIsEqualTo
ogc:PropertyNamecolB </ogc:PropertyName>
ogc:Literal2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>
ogc:Or
ogc:PropertyIsEqualTo
ogc:PropertyNamecolC</ogc:PropertyName>
ogc:Literal3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
Does this makes any sense ?
I have not tried it yet, just need something like this, and had no idea how to write it down.
Best regards
Ricardo
Download new Adobe(R) Flash(R) Builder™ 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder™ 4 (formerly
Flex(R) Builder™) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
Outstanding !
Thank you both very much.
Ricardo
On Fri, Oct 15, 2010 at 11:55 AM, David Winslow <dwinslow@anonymised.com> wrote:
ogc:And
ogc:PropertyIsEqualTo
ogc:PropertyNamecolA</ogc:PropertyName>
ogc:Literal1</ogc:Literal>
</ogc:PropertyIsEqualTo>
ogc:PropertyIsEqualTo
ogc:PropertyNamecolB </ogc:PropertyName>
ogc:Literal2</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:And>