I just found the problem! I hade forgotten to add a rule for when the
isMarked is not true! This is what was missing:

<sld:Rule>
        <sld:Name>Is_Marked and Code</sld:Name>
        <ogc:Filter>
                <ogc:And>
                        <ogc:Not>
                                        <ogc:PropertyIsEqualTo>
                                            
<ogc:PropertyName>isMarked</ogc:PropertyName>
                                                <ogc:Literal>1</ogc:Literal>
                                        </ogc:PropertyIsEqualTo>
                        <ogc:Not>
                        <ogc:PropertyIsEqualTo>
                                <ogc:PropertyName>code</ogc:PropertyName>
                                <ogc:Literal>2</ogc:Literal>
                        </ogc:PropertyIsEqualTo>
                </ogc:And>
        </ogc:Filter>
        <sld:PolygonSymbolizer>
                <sld:Fill>
                        <sld:CssParameter name="fill">
                                <ogc:Literal>#00FFFF</ogc:Literal>
                        </sld:CssParameter>
                        <sld:CssParameter name="stroke">
                                <ogc:Literal>white</ogc:Literal>
                        </sld:CssParameter>
                </sld:Fill>
        </sld:PolygonSymbolizer>
</sld:Rule> 




Zer wrote:
> 
> Hi all,
> 
> I have a vector layer with features with attributes. I would like to use
> two of  these attributes to style the features. One attribute is a code
> that have values between 1-10. The other attribute is a boolean
> (isMarked). I would like to change the fill property (gradient colours) of
> the attribute depending on the code and add a red stroke to the attribute
> if the isMarked == 1. The users select which option to theme by selection
> two check boxes. I have been successful doing this with an SLD.XML file
> and it works fine if i select one of these options at a time. However,
> when i try to combine these attributes i can not get it to work. I would
> like to both add the gradient colours AND the red stroke option if
> isMarked == 1, otherwise only the fill gradient colours . Does anyone know
> how to write such a filter? Or is there another way to make this happen? 
> 
> This is the rules i have uses so far:
> 
> ** This works if I select the code check box only **
> <sld:Rule>
>       <sld:Name>Code</sld:Name>
>       <ogc:Filter>
>               <ogc:PropertyIsEqualTo>
>                       <ogc:PropertyName>code</ogc:PropertyName>
>                       <ogc:Literal>2</ogc:Literal>
>               </ogc:PropertyIsEqualTo>                
>       </ogc:Filter>
>       <sld:PolygonSymbolizer>
>               <sld:Fill>
>                       <sld:CssParameter name="fill">
>                               <ogc:Literal>#00FFFF</ogc:Literal>
>                       </sld:CssParameter>
>                       <sld:CssParameter name="stroke">
>                               <ogc:Literal>white</ogc:Literal>
>                       </sld:CssParameter>
>               </sld:Fill>
>       </sld:PolygonSymbolizer>
> </sld:Rule>
> 
> ** This works if I select the isMarked check box only **      
> <sld:Rule>
>       <sld:Name>Code and Is_Marked</sld:Name>
>       <ogc:Filter>
>               <ogc:PropertyIsEqualTo>
>                       <ogc:PropertyName>isMarked</ogc:PropertyName>
>                       <ogc:Literal>1</ogc:Literal>
>               </ogc:PropertyIsEqualTo>                
>       </ogc:Filter>
>       <sld:PolygonSymbolizer>
>               <sld:Fill>
>                       <sld:CssParameter name="fill">
>                               <ogc:Literal>white</ogc:Literal>
>                       </sld:CssParameter>
>                       <sld:CssParameter name="stroke">
>                               <ogc:Literal>red</ogc:Literal>
>                       </sld:CssParameter>
>               </sld:Fill>
>       </sld:PolygonSymbolizer>
> </sld:Rule>
> 
> ** This does not work if I select BOTHE check boxes. **
> <sld:Rule>
>       <sld:Name>Is_Marked and Code</sld:Name>
>       <ogc:Filter>
>                       <ogc:And>
>                       <ogc:PropertyIsEqualTo>
>                               <ogc:PropertyName>isMarked</ogc:PropertyName>
>                               <ogc:Literal>1</ogc:Literal>
>                       </ogc:PropertyIsEqualTo>
>                       <ogc:PropertyIsEqualTo>
>                               <ogc:PropertyName>code</ogc:PropertyName>
>                               <ogc:Literal>2</ogc:Literal>
>                       </ogc:PropertyIsEqualTo>        
>               </ogc:And>                      
>       </ogc:Filter>
>       <sld:PolygonSymbolizer>
>               <sld:Fill>
>                       <sld:CssParameter name="fill">
>                               <ogc:Literal>#00FFFF</ogc:Literal>
>                       </sld:CssParameter>
>                       <sld:CssParameter name="stroke">
>                               <ogc:Literal>red</ogc:Literal>
>                       </sld:CssParameter>
>               </sld:Fill>
>       </sld:PolygonSymbolizer>
> </sld:Rule>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Styling-a-feature-with-multiple-attributes-using-SLD-tp19165654p19184694.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to