<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style>.EmailQuote {
        BORDER-LEFT: #800000 2px solid; PADDING-LEFT: 4pt; MARGIN-LEFT: 1pt
}
</style><style id="owaParaStyle">P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
</style>
</head>
<body ocsi="0" fPStyle="1">
<div style="FONT-FAMILY: Tahoma; DIRECTION: ltr; COLOR: #000000; FONT-SIZE: 10pt">
<p>Are you sure that no other rule applies?  I've found that when rules' comparison filters are not mutually exclusive the one that gets fired in a particular situation is not easily predictable.  Best to always make sure that only one rule will ever be 'true'.</p>
<p> </p>
<div>
<hr tabindex="-1">
<div id="x_divRplyFwdMsg"><font color="#000000" size="2" face="Tahoma"><b>From:</b> openlayers-users-bounces@lists.osgeo.org [openlayers-users-bounces@lists.osgeo.org] on behalf of joaorodr84 [joaorodr84@gmail.com]<br>
<b>Sent:</b> Monday, April 27, 2015 3:59 AM<br>
<b>To:</b> openlayers-users@lists.osgeo.org<br>
<b>Subject:</b> [OpenLayers-Users] Like query with “singleChar” does not work correctly in OpenLayers.StyleMap<br>
</font><br>
</div>
<div></div>
</div>
<font size="2"><span style="FONT-SIZE: 10pt">
<div class="PlainText">I am working on a GIS API, based on OpenLayers 2.13. I want to represent my<br>
data using WMS and Vector layers.<br>
<br>
Recently, I have started developing the support for LIKE queries in filters<br>
and in style maps.<br>
<br>
*WMS (green stroke color)*<br>
<br>
For WMS layers, the filter is quite simle, as you may know. It must respect<br>
the CQL syntax, for example: `"STATE_NAME LIKE 'N%'"` would match all states<br>
which name starts with an "N".<br>
<br>
For the style map, I build a little structure with OpenLayers,<br>
Style/Rule/Filter, I convert it to an SLD BODY using this `var sld = new<br>
OpenLayers.Format.SLD().write(structure)`, and it works fine.<br>
<br>
*Vector (default orange fill color)*<br>
<br>
As for Vector layers, the filter is an instance of OpenLayers.Filter, which<br>
is easy to build and works fine.<br>
<br>
Here come the strange, and maybe tricky, part. for the style map, it does<br>
not work. I build an OpenLayers.StyleMap, using OpenLayers<br>
Style/Rule/Filter, and I get wrong results. What really bothers me is that I<br>
use a given OpenLayers.Filter as filter and it works fine. But when I use<br>
the same instance of OpenLayers.Filter inside a Rule, inside a Style, inside<br>
a StyleMap, I get wrong results.<br>
<br>
*...*<br>
<br>
The filter expression I am using is:<br>
<br>
    var filter = new OpenLayers.Filter.Comparison({<br>
        property: 'STATE_NAME',<br>
        type: OpenLayers.Filter.Comparison.LIKE,<br>
        value: '.....'<br>
    });<br>
<br>
It should show states which name has 5 letters (it only does not work for<br>
the style map of the vector layer).<br>
<br>
Please check out  this CodePen <<a href="about:blank" target="_blank"></a>https://urldefense.proofpoint.com/v2/url?u=http-3A__codepen.io_joaorodr84_pen_qdErdv&d=BQICAg&c=gpp0UHgwH8jd0f0gRc5QaF0zPfGT1csUQXD9eLov3hQ&r=iiS-4SY2BTp-9WmUwQb3-zEL2tnO_1j_07NMJG-MZ0s&m=yKztGleKJxXFpB9AGFMqsLmYfgmynaVng4ybWtjNkt4&s=bpfuZXMtYI1V9ACCTZmULvikiU8ncMEZB7pqBAa3-Oo&e=
 >  ,<br>
where I have an example code that can easily be changed. Green contour is<br>
the three states that have 5-letter names. In yellow it shows all the states<br>
with 5 or more letters, which is incorrect)<br>
<br>
Thanks a lot<br>
<br>
<br>
<br>
--<br>
View this message in context: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__osgeo-2Dorg.1560.x6.nabble.com_Like-2Dquery-2Dwith-2DsingleChar-2Ddoes-2Dnot-2Dwork-2Dcorrectly-2Din-2DOpenLayers-2DStyleMap-2Dtp5203061.html&d=BQICAg&c=gpp0UHgwH8jd0f0gRc5QaF0zPfGT1csUQXD9eLov3hQ&r=iiS-4SY2BTp-9WmUwQb3-zEL2tnO_1j_07NMJG-MZ0s&m=yKztGleKJxXFpB9AGFMqsLmYfgmynaVng4ybWtjNkt4&s=iOov9phVHUY7Qbv5B-NJhajFidTZSxZP92076BJdfEw&e=" target="_blank">
https://urldefense.proofpoint.com/v2/url?u=http-3A__osgeo-2Dorg.1560.x6.nabble.com_Like-2Dquery-2Dwith-2DsingleChar-2Ddoes-2Dnot-2Dwork-2Dcorrectly-2Din-2DOpenLayers-2DStyleMap-2Dtp5203061.html&d=BQICAg&c=gpp0UHgwH8jd0f0gRc5QaF0zPfGT1csUQXD9eLov3hQ&r=iiS-4SY2BTp-9WmUwQb3-zEL2tnO_1j_07NMJG-MZ0s&m=yKztGleKJxXFpB9AGFMqsLmYfgmynaVng4ybWtjNkt4&s=iOov9phVHUY7Qbv5B-NJhajFidTZSxZP92076BJdfEw&e=</a>
<br>
Sent from the OpenLayers Users mailing list archive at Nabble.com.<br>
_______________________________________________<br>
Users mailing list<br>
Users@lists.osgeo.org<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.osgeo.org_mailman_listinfo_openlayers-2Dusers&d=BQICAg&c=gpp0UHgwH8jd0f0gRc5QaF0zPfGT1csUQXD9eLov3hQ&r=iiS-4SY2BTp-9WmUwQb3-zEL2tnO_1j_07NMJG-MZ0s&m=yKztGleKJxXFpB9AGFMqsLmYfgmynaVng4ybWtjNkt4&s=TVLCFYvtYBgJsAqFs_scvLIVs--3Ktqw8QBRyhRY8II&e=" target="_blank">https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.osgeo.org_mailman_listinfo_openlayers-2Dusers&d=BQICAg&c=gpp0UHgwH8jd0f0gRc5QaF0zPfGT1csUQXD9eLov3hQ&r=iiS-4SY2BTp-9WmUwQb3-zEL2tnO_1j_07NMJG-MZ0s&m=yKztGleKJxXFpB9AGFMqsLmYfgmynaVng4ybWtjNkt4&s=TVLCFYvtYBgJsAqFs_scvLIVs--3Ktqw8QBRyhRY8II&e=</a>
<br>
</div>
</span></font></div>
</body>
</html>