Hello,
Let's say that I have a polygon with a text attribute "attr" containing a
list of values separated by comma, like so for example : "1,15,19"
I would like to filter like so : if the attribute contains else the value 1
or 15 , then...
I tried using PropertyIsLike and escapeChar:
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsLike escapeChar=",">
<ogc:PropertyName>attr</ogc:PropertyName>
<ogc:Literal>1</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:PropertyIsLike escapeChar=",">
<ogc:PropertyName>attr</ogc:PropertyName>
<ogc:Literal>15</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Or>
</ogc:Filter>
But it's not working. Any idea ?
Thank you
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Filtering-on-an-attribute-containing-list-of-values-tp5258310.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
You need to use a wild card in your like expression so something like:
ogc:Filter
ogc:Or
<ogc:PropertyIsLike escapeChar=“#”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal%1,%</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:PropertyIsLike escapeChar=“#”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal%15,%</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Or>
</ogc:Filter>
might work in more cases but will still fail if 1 or 15 are the last in the list,
You could get more control using the filter function isLike as it allows you to use the full java pattern matching
ogc:Filter
<ogc:Function name=“isLike”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal*15[^0-9]?</ogc:Literal>
</ogc:Function>
Ian
···
On 25 March 2016 at 10:45, Geoffrey <balmeg@…84…> wrote:
Hello,
Let’s say that I have a polygon with a text attribute “attr” containing a
list of values separated by comma, like so for example : “1,15,19”
I would like to filter like so : if the attribute contains else the value 1
or 15 , then…
I tried using PropertyIsLike and escapeChar:
ogc:Filter
ogc:Or
<ogc:PropertyIsLike escapeChar=“,”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal1</ogc:Literal>
</ogc:PropertyIsLike>
<ogc:PropertyIsLike escapeChar=“,”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal15</ogc:Literal>
</ogc:PropertyIsLike>
</ogc:Or>
</ogc:Filter>
But it’s not working. Any idea ?
Thank you
–
View this message in context: http://osgeo-org.1560.x6.nabble.com/Filtering-on-an-attribute-containing-list-of-values-tp5258310.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785351&iu=/4140
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
–
Ian Turton
Thank you for your help
Unfortunately, this is not working:
<ogc:Function
name="isLike">
<ogc:PropertyName>attr</ogc:PropertyName>
<ogc:Literal>*15[^0-9]?</ogc:Literal>
</ogc:Function>
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Filtering-on-an-attribute-containing-list-of-values-tp5258310p5258863.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
I knew I should have tested that instead of just typing (go to http://www.regexplanet.com/advanced/java/index.html to test more if needed)
try something like ,?15[^0-9]? - though I think you will need to chop the commas off a strReplace function too. So you;d end up with something like (untested)
<ogc:function name=“strReplace”>
<ogc:Function name=“isLike”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal,?15[^0-9]?</ogc:Literal>
</ogc:Function>
ogc:Literal,</ogc:Literal>
ogc:Literal</ogc:Literal>
ogc:Literaltrue</ogc:Literal>
</ogc:Function>
Ian
···
On 30 March 2016 at 17:16, Geoffrey <balmeg@anonymised.com> wrote:
Thank you for your help
Unfortunately, this is not working:
<ogc:Function
name=“isLike”>
ogc:PropertyNameattr</ogc:PropertyName>
ogc:Literal*15[^0-9]?</ogc:Literal>
</ogc:Function>
–
View this message in context: http://osgeo-org.1560.x6.nabble.com/Filtering-on-an-attribute-containing-list-of-values-tp5258310p5258863.html
Sent from the GeoServer - User mailing list archive at Nabble.com.
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
Geoserver-users mailing list
Geoserver-users@anonymised.comsts.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users
–
Ian Turton