The application shows the possibilities of OpenLayers Format.SLD for coloring and labeling vector and wfs 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.
WFS - request features by attributes
For the WFS layers the filter is used to filter
and style the features. That means, that one can request WFS features by their attributes. It's a bad hack, because I haven't found a way to add the Filter.Comparison to the WFS layer.
Because the filter is used to filter and style features, it's not possible to create a SLD for two rules. Only the first rule are taken.
see also Example Format.SLD Vectors and WMS
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 wfs layers. Connectiontype OGR is used to read the gml data. To change to shape data, use the urlparameter Mapfile=LettersSHP.map.
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.
This application lets one describeone rule with two conditions (Bed2 is checked) ortwo 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.
There are three logical filter : And ("&&"), Or ("||") and Not ("!=")
There are 8 comparision filter
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).
- equal to ("==");
- not equal to ("!=")
- less than ("<")
- greater than (">")
- less than or equal to ("<=")
- greater than or equal to (">=")
- between ("..")
- like ("~")
MapServer has a bug with the filter 'Between' to filter the request of features for CONNECTIONTYPE OGR, GML. To change to shape data, use the urlparameter Mapfile=LettersSHP.map.
MapServer has a bug with 'SLD:filter with And and PropertyIsLike does not work'.
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 5.6.1 is used to deliver the WFS features.
This version has a bug, that the geometry for the features are only returned, if the parameter 'propertyNames:msGeometry' is added to the request!
www.ibbeck.de - OpenLayers Home - gis.ibbeck.de