Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#1863 closed defect (fixed)

generateSLD does not work with complex epression

Reported by: bartvde@… Owned by: assefa
Priority: high Milestone:
Component: MapScript-PHP Version: 4.8
Severity: normal Keywords:
Cc:

Description

When using the following EXPRESSION on class:

( ( ("[DTBOMS]" = "sloot")  AND  (NOT  ([OBJECTID] = 1777) ) ) )

generateSLD generates the following SLD:

<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld"
xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>VGWATER</Name>
<UserStyle>
<FeatureTypeStyle>
<Rule>
<Name>Unknown</Name>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#ff0000</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>

so there is no Filter generated.

Assefa any idea why this is? Is it not implemented for complex expressions?

Change History (7)

comment:1 by dmorissette, 18 years ago

Owner: changed from mapserverbugs to assefa
Assigned to Assefa.

comment:2 by assefa, 18 years ago

Bart,

 Only simple expressions are supported and one level of logical operator.
This is what is supposed to work

/*      Build a filter expression node based on mapserver's class       */
/*      expression. This is limited to simple expressions like :        */
/*        A = B, A < B, A <= B, A > B, A >= B, A != B                   */
/*       It also handles one level of logical expressions :             */
/*        A AND B                                                       */
/*        A OR B                                                        */
/*        NOT A                                                         */

In your case  I am assuming that ( ("[DTBOMS]" = "sloot")  AND   ([OBJECTID] !=
1777)  )  should work.  But not with the NOT

comment:3 by assefa, 18 years ago

Bart,

 Does this work for you as per comment #2 ? If that is the case, please change 
the target of this bug and set it as enhancement.
Thanks

comment:4 by bartvde@…, 18 years ago

Assefa,

I have been looking into this some more, and there is another problem, even if I
use a simple expression (not a complex one). In msSLDBuildFilterEncoding strings
like NOT (from the expression) are used literally in the XML, whereas this
should be ogc:Not.

Can this be fixed?

Example:
EXPRESSION ( (NOT  ([OBJECTID] = 1118) ) )

<NOT>
<ogc:PropertyIsEqualTo><ogc:PropertyName>OBJECTID</ogc:PropertyName><ogc:Literal>1118</ogc:Literal></ogc:PropertyIsEqualTo></NOT>

Bart

comment:5 by bartvde@…, 18 years ago

I am testing Assefa's suggestion now, but the same problem as with NOT also
applies to AND.

Expression:
EXPRESSION ( ( ("[DTBOMS]" = "vijver")  AND  ([OBJECTID] != 1118) ) )

Filter:
<ogc:Filter><ogc:And><ogc:BBOX><ogc:PropertyName>SHAPE</ogc:PropertyName><gml:Box
srsName='EPSG:28992'><gml:coordinates>196979.172058,465372.658627
200781.819658,467654.247187</gml:coordinates></gml:Box></ogc:BBOX><AND>
<ogc:PropertyIsEqualTo><ogc:PropertyName>DTBOMS</ogc:PropertyName><ogc:Literal>vijver</ogc:Literal></ogc:PropertyIsEqualTo>
<ogc:PropertyIsNotEqualTo><ogc:PropertyName>OBJECTID</ogc:PropertyName><ogc:Literal>1118</ogc:Literal></ogc:PropertyIsNotEqualTo></AND></ogc:And></ogc:Filter>

I now do a string substitution temporarily in PHP until this is fixed, but using
Assefa's suggestion a Filter is generated. I will change Chameleon's
expressionbuilder to use ogc:PropertyIsNotLike for != instead of adding <ogc:Not>.

comment:6 by assefa, 18 years ago

Resolution: fixed
Status: newclosed
Fixed in cvs head.

comment:7 by bartvde@…, 18 years ago

Cool Assefa! Thanks. I'll give it a test on Monday.
Note: See TracTickets for help on using tickets.