Multiple SLD Rules for PolygonSymbolizer on a Single Layer

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple SLD Rules for PolygonSymbolizer on a Single Layer

IvanBell

I have a question about how to form a proper SLD rule syntax for GeoServer. The following works for coloring some specified polygons red and coloring the rest of the polygons in the layer yellow.

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/<MLSchema-instance"&gt;'; sld += ' &lt;NamedLayer&gt;'; sld += ' &lt;Name&gt;MyStore:MyLayer&lt;/Name&gt;'; sld += ' &lt;UserStyle&gt;'; sld += ' <FeatureTypeStyle>'; sld += ' <Rule>'; sld += ' <ogc:Filter>'; sld += ' <ogc:FeatureId fid="MyLayer.1" />'; sld += ' <ogc:FeatureId fid="MyLayer.2" />'; sld += ' <ogc:FeatureId fid="MyLayer.3" />'; 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 += ' <ElseFilter/>'; 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 } );

I would like to know how to write the rule for coloring some specified polygons red, some blue, some green, and the rest yellow. Is this possible? I have tried different permutations of the "Or". I have tried to have more than one "ElseFilter". I have tried to separate the rules by FeatureTypeStyle. None of which have worked.

Any help with this would be greatly appreciated. I would settle for a decent SLD resource. The cookbook has only basic examples and not even the spec has anything remotely sophisticated as multiple polygon rules. I have only seen a multiple rule with line, polygon, and point. I have seen some other types of multiple conditional rules; but they all used properties (i.e., Property/Literal, as in the cookbook). I, obviously, am using FeatureId, so those examples do not work in my paradigm. It seems that the OpenLayers.js errs when combining multiple polygon rules.

I am currently using GeoServerversion 2.03 and OpenLayers 2.10.

Sincerely,

Ivan

Reply | Threaded
Open this post in threaded view
|

Re: Multiple SLD Rules for PolygonSymbolizer on a Single Layer

IvanBell
Does anyone have any ideas on this?

It was recommended that I use UDig to create my style and apply it; however, I still cannot find a way to implement multiple styles on the PolygonSymbolizer for a layer.

If I had every polygon on a different layer, then it is a piece of cake.  But, is it really the solution to create 100 layers for a map with 100 features?  Is there really no way to specify multiple style rules within a layer for the PolygonSymbolizer?

The best I have been able to do is with the example above (i.e., color some specified polygon(s) and default the rest).  I really need to specify the style for multiple "sets" of polygons, and default the rest.

Any suggestions, but especially solutions, are appreciated.

Sincerely,
Ivan
Reply | Threaded
Open this post in threaded view
|

Re: Multiple SLD Rules for PolygonSymbolizer on a Single Layer

IvanBell
In reply to this post by IvanBell

I have yet to solve this issue--and it needs to be solved. I would really appreciate any ideas at this point.

I have found a few ways to accomplish the implementation of dynamically colored polygons using multiple style rules. The solutions' pros/cons are detailed below.

  1. Overlay a colored polygon on top of the map in a separate "color" layer.

    Pros Cons
    • I already know how to do this. I.e., it requires no learning curve.
    • It will work for almost every specific map implementation for which I require this functionality.
    • Will not work for IE versions 6-8, due to the sloth-like loading via VML for > 40 polygons. My client will finally be upgrading to IE 7 this year, so it will be years before they upgrade to IE 9 (which finally has SVG support). Switching browsers (version or vendor) is not an option.

  2. Embed my own attribute (equal to the feature id) so that I can create multiple/compound rules for the style.

    Pros Cons
    • Will definitely work, with little performance impact.
    • There are a plethora of examples for both GeoServer and OpenLayers that allows multiple SLD rules based on some attribute other than the feature id (e.g., coloring US state polygons based on population attribute).
    • Will take an exponentially greater amount of time to create the map. We currently have 65 maps to be created (and growing at about 2-3 a year). The layer for which I am trying to solve this contains > 400 polygons on average. Adding a custom attribute to each polygon (unless there is some programmatic/batch method for doing this in ArcGIS) will take longer then creating the rest of the map.

  3. Put each polygon in its own layer.

    ***Not feasible***. This will not work in any case, since there is a hard limit on the number of visible layers (75?) and I have > 400 polygons in the layer.

  4. Create an SLD that dynamically accommodates my need for multiple color styles on a layer.

    Pros Cons
    • Optimal solution that works for both SVG and VML, so is compatible for any past/current/future map or browser versions.
    • Will definitely work, with very little performance impact.
    • There are a plethora of examples for both GeoServer and OpenLayers that does this (e.g., based on population attribute).
    • I haven't been able to achieve this.

For solution #4, I have found an alternate solution to the previously attempted SLD generation (see previous posts), which gets me closer (?) to the solution yet still not all the way there. Basically, I define the filter, rule, and style programmatically (using OpenLayers) and add that style to the layer, instead of manually creating my own SLD string.

I have encountered quite a few issues with this solution, though.

  1. #1: The solution appears to have a hard limit of 35 polygons.

    In the example below, if I add a "MyLayer.36" to the list of FIDs, the image is rendered with the infamous "pink" tile and no Javascript error.

          
    // // Create a filter that defines the polygons (by feature id) to be colored. // var oFilter= new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.1","MyLayer.2","MyLayer.3","MyLayer.4","MyLayer.5","MyLayer.6","MyLayer.7","MyLayer.8","MyLayer.9","MyLayer.10","MyLayer.11","MyLayer.12","MyLayer.13","MyLayer.14","MyLayer.15","MyLayer.16","MyLayer.17","MyLayer.18","MyLayer.19","MyLayer.20","MyLayer.21","MyLayer.22","MyLayer.23","MyLayer.24","MyLayer.25","MyLayer.26","MyLayer.27","MyLayer.28","MyLayer.29","MyLayer.30","MyLayer.31","MyLayer.32","MyLayer.33","MyLayer.34","MyLayer.35"] }); // // Create a color rule based on the filter defined above. // var oRule = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#0000FF", fillOpacity: "0.5", strokeColor: "#00FFFF", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter }); // // Create a color style based on the color rule defined above. // var oColorStyle = new OpenLayers.Style("MyStyle", { rules: [oRule] }); // // Create an SLD based on the color style defined above. // var strSld = new OpenLayers.Format.SLD().write({ namedLayers: [{ name: "MyWorkspace:MyLayer", userStyles: [oColorStyle] }] }); // // Create the layer with the defined SLD. // oPolygonRoomLayer = new OpenLayers.Layer.WMS( "Polygons-Room", "http://localhost:8081/geoserver/wms", { layers: "MyWorkspace:MyLayer", transparent: true, format: "image/png", sld_body: strSld }, { singleTile: true, ratio: 1, isBaseLayer: false } ); . . . Add layer to the map using the addLayers() method . . .
  2. Issue #2: adding multiple filters to the rule is not supported.

    I also tried adding multiple filters to the rule, which is not supported. So, this approach had to be abandoned.

  3. Issue #3: reduced limit on the number of polygons for multiple rules

    In order to try to get "all" of the polygons fit with the currently designated style (by fill/stroke), I tried adding multiple rules to the style, thinking that if I am limited to 35, then two rules should allow 70. Well, if I try to split up the polygons to two separate rules, then I am limited to 25 total polygons, instead of the expected 70.

    E.g., having 35 fids in the first rule and 35 in the second, will yield an invalid pointer on line 156, char 49 of the OpenLayers.js. Reducing the number of fids in the second rule to 1 yields the same error. Having 25 polygons in the first rule and 1 in the second rule yields the pink tile screen and no Javascript error. Having 24 polygons in the first rule and 1 in the second rule colors 25 polygons. Any permutation of first and second rule that adds to 25 will color the 25 polygons defined in each filter.

          
    // // Create filters that define the polygons (by feature id) to be colored. // var oFilter = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.1","MyLayer.2","MyLayer.3","MyLayer.4","MyLayer.5","MyLayer.6","MyLayer.7","MyLayer.8","MyLayer.9","MyLayer.10","MyLayer.11","MyLayer.12","MyLayer.13","MyLayer.14","MyLayer.15","MyLayer.16","MyLayer.17","MyLayer.18","MyLayer.19","MyLayer.20","MyLayer.21","MyLayer.22","MyLayer.23","MyLayer.24"] }); var oFilter2 = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.25"] }); // // Create color rules based on the filters defined above. // var oRule = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#0000FF", fillOpacity: "0.5", strokeColor: "#00FFFF", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter }); var oRule2 = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#0000FF", fillOpacity: "0.5", strokeColor: "#00FFFF", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter2 }); // // Create a color style based on the color rules defined above. // var oColorStyle = new OpenLayers.Style("MyStyle", { rules: [oRule,oRule2] }); // // Create an SLD based on the color style defined above. // var strSld = new OpenLayers.Format.SLD().write({ namedLayers: [{ name: "MyWorkspace.MyLayer", userStyles: [oColorStyle] }] }); // // Create the layer with the defined SLD. // m_oPolygonRoomLayer = new OpenLayers.Layer.WMS( "Polygons-Room", "http://localhost:8081/geoserver/wms", { layers: "MyWorkspace.MyLayer", transparent: true, format: "image/png", sld_body: strSld }, { singleTile: true, ratio: 1, isBaseLayer: false } ); . . . Add layer to the map using the addLayers() method . . .

    So, adding multiple rules appears to reduce the total number of polygons I can define for that particular style. I tried adding three rules to the style and it appears to further reduce the total number of fids to 12.

  4. Issue #4: reduced limit on the number of polygons for multiple styles

    I tried adding multiple styles to the layer, but any style declared after the first one is ignored. I.e., I added the first style with 20 polygons and the second style with 3 polygons. Only the 20 polygons in the first filter/rule/style were colored.

    This method also further reduced the total number of polygons. I.e., if I had 24 polygons in the first style and 1 in the second style, I get the pink screen. The total number of polygons was reduced to 23.

    E.g., if I have 18 in the first style and 6 in the second, I get the pink screen. If I have 18 in the first style and 5 in the second, then I get colored polygons but, again, only for those polygons defined in the first style (i.e., the 18). If I have 23 in the first style and 1 in the second, I get the pink screen; but if I have 22 in the first style and 1 in the second, then I get colored polygons but only for those polygons defined in the first style (i.e., the 22).

          
    // // Create filters that define the polygons (by feature id) to be colored. // var oFilter = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.1","MyLayer.2","MyLayer.3","MyLayer.4","MyLayer.5","MyLayer.6","MyLayer.7","MyLayer.8","MyLayer.9","MyLayer.10","MyLayer.11","MyLayer.12","MyLayer.13","MyLayer.14","MyLayer.15","MyLayer.16","MyLayer.17","MyLayer.18","MyLayer.19","MyLayer.20","MyLayer.21","MyLayer.22"] }); var oFilter2 = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.23"] }); // // Create color rules based on the filters defined above. // var oRule = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#0000FF", fillOpacity: "0.5", strokeColor: "#00FFFF", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter }); var oRule2 = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#0000FF", fillOpacity: "0.5", strokeColor: "#00FFFF", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter2 }); // // Create a color style based on the color rules defined above. // var oColorStyle = new OpenLayers.Style("MyStyle", { rules: [oRule] }); var oColorStyle2 = new OpenLayers.Style("MyStyle2", { rules: [oRule2] }); // // Create an SLD based on the color style defined above. // var strSld = new OpenLayers.Format.SLD().write({ namedLayers: [{ name: "MyWorkspace.MyLayer", userStyles: [oColorStyle,oColorStyle2] }] }); // // Create the layer with the defined SLD. // m_oPolygonRoomLayer = new OpenLayers.Layer.WMS( "Polygons-Room", "http://localhost:8081/geoserver/wms", { layers: "MyWorkspace.MyLayer", transparent: true, format: "image/png", sld_body: strSld }, { singleTile: true, ratio: 1, isBaseLayer: false } ); . . . Add layer to the map using the addLayers() method . . .

    So, using solution #4, I am able to define multiple color rules for my polygons (the original query to this post); but with the described limitations that prohibit its implementation.

    The following example yields 3 different sets of colored polygons; but with similiar limitations described in the issues above (i.e., limited number of colored polygons). For the following, the total number of polygons is limited to 12.

       
    // // Create filters that define the polygons (by feature id) to be colored. // var oFilter = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.1","MyLayer.2","MyLayer.3"] }); var oFilter2 = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.4","MyLayer.5","MyLayer.6","MyLayer.7"] }); var oFilter3 = new OpenLayers.Filter.FeatureId({ fids: ["MyLayer.8","MyLayer.9","MyLayer.10","MyLayer.11","MyLayer.12"] }); // // Create color rules based on the filters defined above. // var oRule = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#0000FF", fillOpacity: "0.5", strokeColor: "#000080", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter }); var oRule2 = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#FF0000", fillOpacity: "0.5", strokeColor: "#800000", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter2 }); var oRule3 = new OpenLayers.Rule({ symbolizer: {"Polygon": { fillColor: "#00FF00", fillOpacity: "0.5", strokeColor: "#008000", strokeWidth: "1", strokeOpacity: "1" }}, filter: oFilter3 }); // // Create a color style based on the color rules defined above. // var oColorStyle = new OpenLayers.Style("MyStyle", { rules: [oRule,oRule2,oRule3] }); // // Create an SLD based on the color style defined above. // var strSld = new OpenLayers.Format.SLD().write({ namedLayers: [{ name: "MyWorkspace.MyLayer", userStyles: [oColorStyle] }] }); // // Create the layer with the defined SLD. // m_oPolygonRoomLayer = new OpenLayers.Layer.WMS( "Polygons-Room", "http://localhost:8081/geoserver/wms", { layers: "MyWorkspace.MyLayer", transparent: true, format: "image/png", sld_body: strSld }, { singleTile: true, ratio: 1, isBaseLayer: false } ); . . . Add layer to the map using the addLayers() method . . .

    OpenLayers version: 2.1.0
    GeoServer version: 2.0.3

    I am not sure how to proceed from here. I am not even sure if this is a GeoServer or an OpenLayers issue. I am sure that someone out there can help me, if only pointing me toward the solution in lieu of providing the precise one. Until my client upgrades to IE version 9, I will be unable to use the vector/feature overlay approach. So, until then, I need to solve this using SLD (I presume).

    The biggest issue I seem to have is that no one else's examples or issues seem to match my requirements. E.g., all of their features for a layer have the same style (e.g., all rivers in the river layer are blue) or are based upon a custom attribute (e.g., colors of the U.S. states are based upon the population attribute). I am hoping someone with significant knowledge of WMS or OpenLayers or GeoServer or whatever can help point me in the right direction or solve the issues described above.

    Thank you in advance for your help. I will post the solution if/when I ever find it.

    Sincerely,

    Ivan Bell

Reply | Threaded
Open this post in threaded view
|

Re: Multiple SLD Rules for PolygonSymbolizer on a Single Layer

IvanBell
In reply to this post by IvanBell

This is NOT a GeoServer issue. I created the following style and configured my layer directly in GeoServer and it worked fine. Even the ElseFilter worked fine. So, it can only be surmised that all of the limitations and issues I have found are OpenLayers' limitations/issues.

<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>MyWorkspace:MyLayer</sld:Name> <sld:UserStyle> <sld:FeatureTypeStyle> <sld:Rule> <ogc:Filter> <ogc:FeatureId fid="MyLayer.33"/> <ogc:FeatureId fid="MyLayer.34"/> <ogc:FeatureId fid="MyLayer.35"/> <ogc:FeatureId fid="MyLayer.36"/> <ogc:FeatureId fid="MyLayer.37"/> <ogc:FeatureId fid="MyLayer.38"/> <ogc:FeatureId fid="MyLayer.39"/> <ogc:FeatureId fid="MyLayer.40"/> <ogc:FeatureId fid="MyLayer.41"/> <ogc:FeatureId fid="MyLayer.42"/> <ogc:FeatureId fid="MyLayer.43"/> <ogc:FeatureId fid="MyLayer.44"/> <ogc:FeatureId fid="MyLayer.45"/> <ogc:FeatureId fid="MyLayer.46"/> <ogc:FeatureId fid="MyLayer.53"/> <ogc:FeatureId fid="MyLayer.54"/> <ogc:FeatureId fid="MyLayer.55"/> <ogc:FeatureId fid="MyLayer.56"/> <ogc:FeatureId fid="MyLayer.57"/> <ogc:FeatureId fid="MyLayer.58"/> <ogc:FeatureId fid="MyLayer.60"/> <ogc:FeatureId fid="MyLayer.61"/> <ogc:FeatureId fid="MyLayer.65"/> <ogc:FeatureId fid="MyLayer.66"/> <ogc:FeatureId fid="MyLayer.67"/> <ogc:FeatureId fid="MyLayer.68"/> <ogc:FeatureId fid="MyLayer.69"/> <ogc:FeatureId fid="MyLayer.70"/> <ogc:FeatureId fid="MyLayer.71"/> <ogc:FeatureId fid="MyLayer.72"/> <ogc:FeatureId fid="MyLayer.73"/> <ogc:FeatureId fid="MyLayer.74"/> <ogc:FeatureId fid="MyLayer.75"/> <ogc:FeatureId fid="MyLayer.76"/> <ogc:FeatureId fid="MyLayer.77"/> <ogc:FeatureId fid="MyLayer.78"/> <ogc:FeatureId fid="MyLayer.79"/> <ogc:FeatureId fid="MyLayer.80"/> <ogc:FeatureId fid="MyLayer.81"/> <ogc:FeatureId fid="MyLayer.82"/> <ogc:FeatureId fid="MyLayer.83"/> <ogc:FeatureId fid="MyLayer.84"/> <ogc:FeatureId fid="MyLayer.85"/> <ogc:FeatureId fid="MyLayer.86"/> <ogc:FeatureId fid="MyLayer.87"/> <ogc:FeatureId fid="MyLayer.88"/> <ogc:FeatureId fid="MyLayer.89"/> <ogc:FeatureId fid="MyLayer.90"/> <ogc:FeatureId fid="MyLayer.91"/> <ogc:FeatureId fid="MyLayer.94"/> <ogc:FeatureId fid="MyLayer.98"/> <ogc:FeatureId fid="MyLayer.99"/> </ogc:Filter> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#0000FF</sld:CssParameter> <sld:CssParameter name="fill-opacity">0.5</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="MyLayer.1"/> <ogc:FeatureId fid="MyLayer.2"/> <ogc:FeatureId fid="MyLayer.3"/> <ogc:FeatureId fid="MyLayer.4"/> <ogc:FeatureId fid="MyLayer.5"/> <ogc:FeatureId fid="MyLayer.6"/> <ogc:FeatureId fid="MyLayer.7"/> <ogc:FeatureId fid="MyLayer.8"/> <ogc:FeatureId fid="MyLayer.9"/> <ogc:FeatureId fid="MyLayer.10"/> <ogc:FeatureId fid="MyLayer.11"/> <ogc:FeatureId fid="MyLayer.12"/> </ogc:Filter> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#FF0000</sld:CssParameter> <sld:CssParameter name="fill-opacity">0.5</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="MyLayer.233"/> <ogc:FeatureId fid="MyLayer.151"/> <ogc:FeatureId fid="MyLayer.163"/> <ogc:FeatureId fid="MyLayer.150"/> <ogc:FeatureId fid="MyLayer.162"/> <ogc:FeatureId fid="MyLayer.149"/> <ogc:FeatureId fid="MyLayer.161"/> <ogc:FeatureId fid="MyLayer.148"/> <ogc:FeatureId fid="MyLayer.160"/> <ogc:FeatureId fid="MyLayer.147"/> <ogc:FeatureId fid="MyLayer.146"/> <ogc:FeatureId fid="MyLayer.145"/> <ogc:FeatureId fid="MyLayer.159"/> <ogc:FeatureId fid="MyLayer.144"/> <ogc:FeatureId fid="MyLayer.180"/> <ogc:FeatureId fid="MyLayer.183"/> <ogc:FeatureId fid="MyLayer.184"/> <ogc:FeatureId fid="MyLayer.185"/> <ogc:FeatureId fid="MyLayer.181"/> <ogc:FeatureId fid="MyLayer.182"/> <ogc:FeatureId fid="MyLayer.186"/> <ogc:FeatureId fid="MyLayer.187"/> <ogc:FeatureId fid="MyLayer.198"/> <ogc:FeatureId fid="MyLayer.199"/> <ogc:FeatureId fid="MyLayer.197"/> <ogc:FeatureId fid="MyLayer.196"/> <ogc:FeatureId fid="MyLayer.195"/> <ogc:FeatureId fid="MyLayer.194"/> <ogc:FeatureId fid="MyLayer.193"/> <ogc:FeatureId fid="MyLayer.192"/> <ogc:FeatureId fid="MyLayer.191"/> <ogc:FeatureId fid="MyLayer.190"/> <ogc:FeatureId fid="MyLayer.189"/> <ogc:FeatureId fid="MyLayer.188"/> </ogc:Filter> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#00FF00</sld:CssParameter> <sld:CssParameter name="fill-opacity">0.5</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="MyLayer.64"/> <ogc:FeatureId fid="MyLayer.63"/> <ogc:FeatureId fid="MyLayer.62"/> <ogc:FeatureId fid="MyLayer.47"/> <ogc:FeatureId fid="MyLayer.18"/> <ogc:FeatureId fid="MyLayer.48"/> <ogc:FeatureId fid="MyLayer.19"/> <ogc:FeatureId fid="MyLayer.49"/> <ogc:FeatureId fid="MyLayer.20"/> <ogc:FeatureId fid="MyLayer.50"/> <ogc:FeatureId fid="MyLayer.21"/> <ogc:FeatureId fid="MyLayer.51"/> <ogc:FeatureId fid="MyLayer.22"/> <ogc:FeatureId fid="MyLayer.52"/> <ogc:FeatureId fid="MyLayer.23"/> <ogc:FeatureId fid="MyLayer.59"/> <ogc:FeatureId fid="MyLayer.221"/> <ogc:FeatureId fid="MyLayer.222"/> <ogc:FeatureId fid="MyLayer.226"/> <ogc:FeatureId fid="MyLayer.225"/> <ogc:FeatureId fid="MyLayer.224"/> <ogc:FeatureId fid="MyLayer.223"/> <ogc:FeatureId fid="MyLayer.117"/> <ogc:FeatureId fid="MyLayer.115"/> <ogc:FeatureId fid="MyLayer.97"/> <ogc:FeatureId fid="MyLayer.114"/> <ogc:FeatureId fid="MyLayer.96"/> <ogc:FeatureId fid="MyLayer.113"/> <ogc:FeatureId fid="MyLayer.95"/> <ogc:FeatureId fid="MyLayer.105"/> <ogc:FeatureId fid="MyLayer.92"/> <ogc:FeatureId fid="MyLayer.104"/> </ogc:Filter> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#FFFF00</sld:CssParameter> <sld:CssParameter name="fill-opacity">0.5</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> <sld:ElseFilter/> <sld:PolygonSymbolizer> <sld:Fill> <sld:CssParameter name="fill">#00FFFF</sld:CssParameter> <sld:CssParameter name="fill-opacity">0.5</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>

I will post my issue in the OpenLayers forum and link to these posts.

Sincerely,
Ivan

Reply | Threaded
Open this post in threaded view
|

Re: Multiple SLD Rules for PolygonSymbolizer on a Single Layer

IvanBell
Please refer to http://osgeo-org.1803224.n2.nabble.com/OpenLayers-SLD-Bug-td6453498.html for the final workaround for the OpenLayers SLD bug.