Squares WMS Squares Letters WMS Letters
Rule Rule 1 Rule 2 Bed 2 Else
name
field  
value  
typeLogical  
typeComparison  
symbolizer
strokeColor
strokeOpacity
strokeWidth
fillColor
fillOpacity
pointRadius
text
label
labelXOffset
labelYOffset
fontColor
fontSize
fontFamily
fontWeight
labelAlign
 
Example Format.SLD Vectors and WMS[x]

The application shows the possibilities of OpenLayers Format.SLD for coloring and labeling vector and wms layer with SLD. One can create interactive a SLD file and apply it to the selected layer. It's also possible to build a SLD file for own data.

The application supports only the sld creation for one layer, one userstyle, one logical level and two separate conditions or rules. It's a restriction of this application and not of OpenLayers.

A patched version of the OpenLayers.Format.SLD.v1 is used to support label placement. Propably labelAlign wrong coded, because the labels for the wms layer are not placed like the labels for the vector layer.

see also Example Format.SLD Vectors and WFS

Data
There are two different data sources with the same attributes to test various filter expressions. First 26 squares and second the 26 letters of the alphabet both polygon features. The vector layer and the WMS layer use the same GML data.



The deprecated OpenLayers.Layer.Vector.GML is used to display the gml data.

MapServer 5.6.1 is used to deliver the the wms layers. Connectiontype OGR is used to read the gml data. SLD used for the initial styling of the data
A layer 'Tiles', that only shows the border of the wms tiles, is added to the map to show the problem with the labels for the wms layers at the tile edges.

A url parameter 'singleTile' can be used to force singleTile=true for the wms layers.

Properties

Rules

This application lets one describe

  • one rule with two conditions (Bed2 is checked) or
  • two rules with one condition (Rule 2 is checked)

    to select features by their attributes. In the first case the filter Logical of Rule 1 are taken for both conditions. The third rule is the ElseFilter. Here one can only edit the display properties.

    Filter.Logical

    There are three logical filter : And ("&&"), Or ("||") and Not ("!=")

    Filter.Comparision

    There are 8 comparision filter
    • equal to ("==");
    • not equal to ("!=")
    • less than ("<")
    • greater than (">")
    • less than or equal to ("<=")
    • greater than or equal to (">=")
    • between ("..")
    • like ("~")
    The value to match can be a single value (indices = 22) or a list of comma-separated values (indices = 12,22,32). To indicate the lower and upper boundary for the filter 'Between' it is used '-' as separator (indices between 11-15). Wildcards for the 'Like' filter are '*' (0 to many chars) and '.' (0 or 1 char).

    Noch was

    For the vector layer the Rule 2 overwrites Rule 1, if same features filtered. For the WMS the order is turned.

    The Comparision filter 'like' seems not to work as expected. It's not possible to use an expression only with a point for a single char (.2) or a static string (22). It causes an error 'this.value.replace is not a function'. It works only in conjunction with '*' (*.2, 22*). Also I don't understand, why '*2' finds items like 21, 23, 24.

    MapServer has a bug with 'SLD:filter with And and PropertyIsLike does not work'.

    www.ibbeck.de - OpenLayers Home - gis.ibbeck.de