<p>I am having difficulty troubleshooting an OpenLayers issue I have had for several weeks now. The issue concerns coloring polygons in a layer using multiple SLD styles filtered by the polygons' feature id.</p>
<p>I had a variation of the issue posted in <a href="http://osgeo-org.1803224.n2.nabble.com/WMS-polygon-fill-color-td6374589.html" target="_top" rel="nofollow" link="external">this forum</a> a few weeks ago, when I was trying to figure out SLD and before I even knew there was an OpenLayers issue with SLD.</p>
<p>I also posted an <a href="http://osgeo-org.1803224.n2.nabble.com/Multiple-SLD-Rules-for-PolygonSymbolizer-on-a-Single-Layer-td6378253.html" target="_top" rel="nofollow" link="external">SLD syntax issue</a> to the GeoServer forum.</p>
<p>On Monday, I was able to eliminate GeoServer as the problem.</p>
<p>The OpenLayers problems I am having are detailed in the <a href="http://osgeo-org.1803224.n2.nabble.com/Multiple-SLD-Rules-for-PolygonSymbolizer-on-a-Single-Layer-td6378253.html#a6432838" target="_top" rel="nofollow" link="external">06/02 post to the SLD syntax issue</a> in the GeoServer forum.</p>
<p>Basically, within GeoServer, if I configure/apply the following default SLD style for the layer:</p>
<pre><blockquote>
<sld:StyledLayerDescriptor
xmlns:sld=\"http://www.opengis.net/sld\"
version=\"1.0.0\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xsi:schemaLocation=\"http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd\"
xmlns:ogc=\"http://www.opengis.net/ogc\"
xmlns:gml=\"http://www.opengis.net/gml\">
<sld:NamedLayer>
<sld:Name>LaPalma:Polygon_Layer_Room</sld:Name>
<sld:UserStyle>
<sld:FeatureTypeStyle>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.1\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.2\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.3\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.4\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.5\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.6\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.7\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.8\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.9\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.10\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#0000FF</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#000080</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.11\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.12\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.13\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.14\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.15\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.16\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.17\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#FF0000</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#800000</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.18\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.19\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.20\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#00FF00</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#008000</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.21\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.22\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.23\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.24\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.25\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#FFFF00</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#808000</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.26\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.27\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.28\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.29\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.30\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.31\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.32\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.33\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#FF007F</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#C71585</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.34\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.35\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.36\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#FFC0CB</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#FF3E96</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.37\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.38\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.39\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.40\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.41\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#800080</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#68228B</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<ogc:Filter>
<ogc:FeatureId fid=\"Polygon_Layer_Room.42\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.43\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.44\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.45\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.46\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.47\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.48\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.49\"/>
<ogc:FeatureId fid=\"Polygon_Layer_Room.50\"/>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#C00000</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#FF1CAE</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<sld:ElseFilter/>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name=\"fill\">#00FFFF</sld:CssParameter>
<sld:CssParameter name=\"fill-opacity\">0.8</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name=\"stroke\">#0000FF</sld:CssParameter>
<sld:CssParameter name=\"stroke-opacity\">1</sld:CssParameter>
<sld:CssParameter name=\"stroke-width\">1</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>
</blockquote>
</pre>
<p>then the map is correctly rendered with the various colors/styles for the named polygons (by feature id) in that layer. This also includes the "rest" of the polygons defined by the <ElseFilter/> style, the use of which I was having issues combining with the fid filters.</p>
<p>If, however, I try any variation of applying this SLD using OpenLayers, I get the errors described in the <a href="http://osgeo-org.1803224.n2.nabble.com/Multiple-SLD-Rules-for-PolygonSymbolizer-on-a-Single-Layer-td6378253.html#a6432838" target="_top" rel="nofollow" link="external">6/2 post</a>.</p>
<p>Can anyone please tell me how to apply the above SLD style (or anything similar) using OpenLayers, or is there an OpenLayers SLD bug?</p>
<p>Even if you don't have a solution, any suggestions that might point me to one would be appreciated.</p>
<p>Sincerely,<br>
Ivan Bell</p>
        <div class="signature">Up the Irons!!!</div>
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/OpenLayers-SLD-Bug-tp6453498p6453498.html">OpenLayers SLD Bug?</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/>