[OpenLayers-Users] SLD_BODY with 'like' filter

Andreas Hocevar ahocevar at opengeo.org
Thu Oct 29 12:07:07 EDT 2009


The problem is that your filter does not have any wild cards, and that I 
forgot to tell you about value2regex.

So after defining your rule, you should do

rule.value2regex("*", "?");

If you want to find "mother" and "moocow", your value should be "mo*".
That's the string wildcard. If you want to find "daddy" and "duddy",
your value should be "d?ddy". That's the char wildcard.

Regards,
Andreas.

stash wrote:
>
> stash wrote:
>   
>> Hi,
>> thanks for your answer. I will try your example out immediately. 
>>
>> But I have one question. What do you mean by string wildcard and char
>> wildcard?
>>
>> Regards
>> stash
>>
>>
>>     
>
> I don't get an error when I start my script with your example. That is good.
> Unfortunately, instead of getting some entrys on my map I get a white sheet
> without any entries.
>
> What can I do now?
>
> That is my code for the like filter: Is there something wrong (I only want
> to show the entries which begin with "Ve")
>
> var filter = new OpenLayers.Filter.Comparison({
>     type: OpenLayers.Filter.Comparison.LIKE,
>     property: "NAME",
>     value: "Ve" // * string wildcard, ? char wildcard
> });
>   


-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.





More information about the Users mailing list