AW: [OpenLayers-Users] OpenLayers SLD Bug?

Arnd Wippermann arnd.wippermann at web.de
Wed Jun 8 16:21:15 EDT 2011


Hi,
 
if i take your sld file and modify it for my datset, i have no problem to
apply it as SLD or SLD_BODY to the wms layer. Using OpenLayers 2.10 and
MapServer.
So it seems it's not a bug with OpenLayers.
 
online example
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL210/MapServer_SLD_World/MapServ
er_SLD_World.asp?SLDsrcIdx=56
 

Arnd
 
  _____  

Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von IvanBell
Gesendet: Mittwoch, 8. Juni 2011 14:58
An: users at openlayers.org
Betreff: [OpenLayers-Users] OpenLayers SLD Bug?



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.

I had a variation of the issue posted in this forum
<http://osgeo-org.1803224.n2.nabble.com/WMS-polygon-fill-color-td6374589.htm
l>  a few weeks ago, when I was trying to figure out SLD and before I even
knew there was an OpenLayers issue with SLD.

I also posted an SLD syntax issue
<http://osgeo-org.1803224.n2.nabble.com/Multiple-SLD-Rules-for-PolygonSymbol
izer-on-a-Single-Layer-td6378253.html>  to the GeoServer forum.

On Monday, I was able to eliminate GeoServer as the problem.

The OpenLayers problems I am having are detailed in the 06/02 post to the
SLD syntax issue
<http://osgeo-org.1803224.n2.nabble.com/Multiple-SLD-Rules-for-PolygonSymbol
izer-on-a-Single-Layer-td6378253.html#a6432838>  in the GeoServer forum.

Basically, within GeoServer, if I configure/apply the following default SLD
style for the layer:



      <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>


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.

If, however, I try any variation of applying this SLD using OpenLayers, I
get the errors described in the 6/2 post
<http://osgeo-org.1803224.n2.nabble.com/Multiple-SLD-Rules-for-PolygonSymbol
izer-on-a-Single-Layer-td6378253.html#a6432838> .

Can anyone please tell me how to apply the above SLD style (or anything
similar) using OpenLayers, or is there an OpenLayers SLD bug?

Even if you don't have a solution, any suggestions that might point me to
one would be appreciated.

Sincerely,
Ivan Bell

Up the Irons!!!

  _____  

View this message in context: OpenLayers
<http://osgeo-org.1803224.n2.nabble.com/OpenLayers-SLD-Bug-tp6453498p6453498
.html> SLD Bug?
Sent from the OpenLayers
<http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Users-f1822463.html>
Users mailing list archive at Nabble.com.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110608/34b63921/attachment-0001.html


More information about the Users mailing list