<P>Works like a champ. Thanks a lot. I tried for quite a few days to find the solution to this.</P>
<P>I have a follow-up about my SLD:</P>
<PRE>
<BLOCKQUOTE>
var sld = '<StyledLayerDescriptor version="1.0.0"';
sld += ' xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" ';
sld += ' xmlns="http://www.opengis.net/sld" ';
sld += ' xmlns:ogc="http://www.opengis.net/ogc" ';
sld += ' xmlns:xlink="http://www.w3.org/1999/xlink" ';
sld += ' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">';
sld += ' <NamedLayer>';
sld += ' <Name>MyStore:MyLayer</Name>';
sld += ' <UserStyle>';
sld += ' <Name>Colored Polygon</Name>';
sld += ' <Title>Colored Polygon</Title>';
sld += ' <FeatureTypeStyle>';
sld += ' <Rule>';
sld += ' <ogc:Filter>';
sld += ' <ogc:Or>';
sld += ' <ogc:FeatureId fid="MyLayer.1" />';
sld += ' <ogc:FeatureId fid="MyLayer.2" />';
sld += ' <ogc:FeatureId fid="MyLayer.3" />';
sld += ' </ogc:Or>';
sld += ' </ogc:Filter>';
sld += ' <PolygonSymbolizer>';
sld += ' <Fill>';
sld += ' <CssParameter name="fill">#FF0000</CssParameter>';
sld += ' <CssParameter name="fill-opacity">0.5</CssParameter>';
sld += ' </Fill>';
sld += ' <Stroke>';
sld += ' <CssParameter name="stroke">#800000</CssParameter>';
sld += ' <CssParameter name="stroke-width">2</CssParameter>';
sld += ' </Stroke>';
sld += ' </PolygonSymbolizer>';
sld += ' </Rule>';
sld += ' <Rule>';
sld += ' <ogc:Filter>';
sld += ' <ogc:Not>';
sld += ' <ogc:Or>';
sld += ' <ogc:FeatureId fid="MyLayer.1" />';
sld += ' <ogc:FeatureId fid="MyLayer.2" />';
sld += ' <ogc:FeatureId fid="MyLayer.3" />';
sld += ' </ogc:Or>';
sld += ' </ogc:Not>';
sld += ' </ogc:Filter>';
sld += ' <PolygonSymbolizer>';
sld += ' <Fill>';
sld += ' <CssParameter name="fill">#FFFF00</CssParameter>';
sld += ' <CssParameter name="fill-opacity">0.5</CssParameter>';
sld += ' </Fill>';
sld += ' <Stroke>';
sld += ' <CssParameter name="stroke">#CCCC00</CssParameter>';
sld += ' <CssParameter name="stroke-width">2</CssParameter>';
sld += ' </Stroke>';
sld += ' </PolygonSymbolizer>';
sld += ' </Rule>';
sld += ' </FeatureTypeStyle>';
sld += ' </UserStyle>';
sld += ' </NamedLayer>';
sld += '</StyledLayerDescriptor>';
coloredLayer = new OpenLayers.Layer.WMS(
"Polygons-Room", "http://localhost:8081/geoserver/wms",
{
layers: "MyStore:MyLayer",
transparent: true,
format: 'image/png',
sld_body: sld
},
{
singleTile: true,
ratio: 1,
isBaseLayer: false
}
);
</BLOCKQUOTE>
</PRE>
<P>Referring to the two rules above, if I include one or the other they work as expected. However, having both of them fails to color any polygon.</P>
<P>E.g., if I comment out the first rule, then all of the polygons that do not have the fid of "MyLayer.1", "MyLayer.2", or "MyLayer.3" will be colored yellow. If I comment out the second rule, then the "MyLayer.1", "MyLayer.2", and "MyLayer.3" polygons will be colored red. If both are uncommented, then none of the polygons are colored.</P>
<P>Could you tell me how to write the rule(s) properly? I.e., I want the three polygons to be colored/highlighted red and the rest of the polygons in the layer (for which I may/may not know the fid) to be colored/defaulted to yellow.</P>
<P>Thanks in advance for your help.</P>
<P>Sincerely,</P>
<P>Ivan</P>
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/WMS-polygon-fill-color-tp6374589p6375545.html">Re: AW: [OpenLayers-Users] WMS polygon fill color</a><br/>
Sent from the <a href="http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html">OpenLayers Users mailing list archive</a> at Nabble.com.<br/>