Opened 15 years ago

Closed 13 years ago

#3064 closed defect (fixed)

SLD: filter with And and PropertyIsLike does not work

Reported by: bartvde Owned by: assefa
Priority: normal Milestone: 5.6.4 release
Component: WMS Server Version: 5.6
Severity: normal Keywords:
Cc: gislab

Description

An SLD like the following does not work correctly:

<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><NamedLayer><Name>GARBANK001</Name><UserStyle><FeatureTypeStyle><Rule><Name>default</Name><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:And><ogc:PropertyIsEqualTo><ogc:PropertyName>VERVALLEN</ogc:PropertyName><ogc:Literal>nee</ogc:Literal></ogc:PropertyIsEqualTo><ogc:PropertyIsLike wildCard="*" singleChar="." escape="!"><ogc:PropertyName>BAAN</ogc:PropertyName><ogc:Literal>*YY*</ogc:Literal></ogc:PropertyIsLike></ogc:And></ogc:Filter><PolygonSymbolizer><Fill><CssParameter name="fill">#000000</CssParameter></Fill></PolygonSymbolizer></Rule></FeatureTypeStyle></UserStyle></NamedLayer></StyledLayerDescriptor>

In FLTGetLogicalComparisonExpresssion (mapogcfilter.c) first the part stating "special case for PropertyIsLike" is reached, and this function returns. So only 1 part of the filter is actually interpreted and used.

A "hack" which made things work for me is commenting out 1 line in mapogc.sld:

                                //if (FLTHasSpatialFilter(psNode))
                                  psLayer->layerinfo = (void *)psNode;

Attachments (1)

bug3064-5.6.x.zip (3.8 KB ) - added by assefa 14 years ago.
patch against 5.6 branch

Download all attachments as: .zip

Change History (8)

comment:1 by assefa, 15 years ago

Owner: changed from mapserverbugs to assefa
Status: newassigned

comment:2 by bartvde, 15 years ago

Resolution: worksforme
Status: assignedclosed

Can't reproduce this one anymore.

comment:3 by Mavka, 14 years ago

Milestone: 5.4.1 release5.6.1 release
Resolution: worksforme
Status: closedreopened

Under debug I can see filter conversion:

IsEqualTo

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
	<ogc:Or>
		<ogc:PropertyIsEqualTo>
			<ogc:PropertyName>c_ring_e</ogc:PropertyName>
			<ogc:Literal>UKRAINA</ogc:Literal>
		</ogc:PropertyIsEqualTo>
		<ogc:PropertyIsEqualTo>
			<ogc:PropertyName>c_ring_e</ogc:PropertyName>
			<ogc:Literal>RUSSIA</ogc:Literal>
		</ogc:PropertyIsEqualTo>
	</ogc:Or>
</ogc:Filter>
EXPRESSION ( ("[c_ring_e]" = "UKRAINA")  Or  ("[c_ring_e]" = "RUSSIA") )

IsLike

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
	<ogc:Or>
		<ogc:PropertyIsLike wildCard="*" singleChar="%" escape="!">
			<ogc:PropertyName>c_ring_e</ogc:PropertyName>
			<ogc:Literal>UKRAINA</ogc:Literal>
		</ogc:PropertyIsLike>
		<ogc:PropertyIsLike wildCard="*" singleChar="%" escape="!">
			<ogc:PropertyName>c_ring_e</ogc:PropertyName>
			<ogc:Literal>RUSSIA</ogc:Literal>
		</ogc:PropertyIsLike>
	</ogc:Or>
</ogc:Filter>
CLASSITEM "c_ring_e"
EXPRESSION /^RUSSIA/

comment:4 by Mavka, 14 years ago

Milestone: 5.6.1 release
Version: unspecified5.6

Autotest # Verify PropertyIsLike with logical operators is incorrect:

CLASSITEM "NAME"
EXPRESSION /^3/

comment:5 by gislab, 14 years ago

Cc: gislab added

comment:6 by assefa, 14 years ago

Milestone: 5.6.4 release

sorry for the delay on this. This was already fixed in trunk part of #2720 (http://trac.osgeo.org/mapserver/changeset/9584)

It was not fixed in the 5.6 branch. I have prepared a patch for the branch. I am a bit hesitate to apply without further tests. Please use the patch and let me know.

by assefa, 14 years ago

Attachment: bug3064-5.6.x.zip added

patch against 5.6 branch

comment:7 by assefa, 13 years ago

Resolution: fixed
Status: reopenedclosed

This is fixed in trunk. Closing

Note: See TracTickets for help on using tickets.