[OpenLayers-Users] OpenLayers.Filter.Comparison.LIKE and singleChar

Andreas Hocevar ahocevar at opengeo.org
Thu Aug 5 11:38:00 EDT 2010


Hi,

Eric's patch won't solve the problem, because the input to the filter will then be "0.2" instead of ".2".

Arnd, can you please create a ticket? This behavior was introduced by http://trac.openlayers.org/changeset/8927, and I think it would be better to cast in filter.evaluate rather than in format readers.

Regards,
Andreas.

On Aug 5, 2010, at 17:31 , Eric Lemoine wrote:

> On Thu, Aug 5, 2010 at 2:28 PM, Arnd Wippermann <arnd.wippermann at web.de> wrote:
>> Hi Eric,
>> 
>> thanks for the reply and the hint. It's a more complex situation.
>> 
>> It's not a problem with the filter, but with OpenLayers.Format.SLD().read:
>> 
>> I create a SLD and apply it to a vector layer
>> 
>> var formatSLD = new OpenLayers.Format.SLD();
>> var sld       = formatSLD.read(theSLD_BODY);
>> ...
>> 
>> It works perfect, but only the LIKE-filter with "." works not.
>> 
>> The filterpart from theSLD_BODY for this case looks like
>> 
>> <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
>> <ogc:PropertyIsLike wildCard="*" singleChar="." escape="!">
>> <ogc:PropertyName>indice</ogc:PropertyName>
>> <ogc:Literal>.2</ogc:Literal>
>> </ogc:PropertyIsLike>
>> </ogc:Filter>
>> 
>> The ".2" enters the function OpenLayers.Filter.Comparison.value2regex
>> 
>> as 0.2 as number (typeof this.value -> number ?!)
>> 
>> and causes the error "this.value.replace is not a function".
>> 
>> if I overwrite the function by adding this.value=this.value.toString(), then
>> the error vanishes, but the applied rule to the vector layer doesn't result
>> in a correct style.
>> 
>> Appling the same SLD to the WMS layer, shows the correct style. It seems,
>> the SLD is correct.
>> 
>> I remember a case with labels like 02.09, that change to 2.09. Perhaps the
>> same issue.
>> 
>> If you have any hint, where to further look?
> 
> Does the attached patch solve the problem?
> 
> -- 
> Eric Lemoine
> 
> Camptocamp France SAS
> Savoie Technolac, BP 352
> 73377 Le Bourget du Lac, Cedex
> 
> Tel : 00 33 4 79 44 44 96
> Mail : eric.lemoine at camptocamp.com
> http://www.camptocamp.com
> <patch>_______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users



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




More information about the Users mailing list