I know it works like a charm for vector layers. But considering that we can make the symbolizers use attribute values in the SLD, I think OpenLayers should support it. But apparently it doesn't.
In the example below, I have a layer with 10 points, where the attribute *ogc_fid* has the values 1, 2, ..., 10. I want the stroke width of each point to be the value of its *ogc_fid* attribute. Here <http://codepen.io/joaorodr84/pen/LVRQgg> is the whole code, but I will explain the most important parts. /* Rule */ var rule = new OpenLayers.Rule({ filter: filter, symbolizer: { Point: { fillColor: '#dddd00', fillOpacity: 1, pointRadius: 30, strokeWidth: '${ogc_fid}', graphicName: 'circle' }, Text: { label: '${ogc_fid}' } } }); Above, I have the rule, where I use *strokeWidth: '${ogc_fid}'* indicating that I want the stroke width to assume the value of the `ogc_fid` attribute of its respective point. I convert it to SLD using the *OpenLayers.Format.SLD().write* method, and I get this: <sld:CssParameter name="stroke-width">${ogc_fid}</sld:CssParameter> When I should be getting this: <sld:CssParameter name="stroke-width"> <ogc:PropertyName>ogc_fid</ogc:PropertyName> </sld:CssParameter> The button *Custom SLD depending on stroke width (hard coded)* set a custom SLD that I hard coded and that contains the above correction. This way, you can see what I am looking for. My big questions are: 1) Why doesn't the *OpenLayers.Format.SLD().write* method do this correction automatically? 2) How could I obtain a correct conversion to SLD? Maybe by overloading the `OpenLayers.Format.SLD().write` method. But how?? Thanks a lot! João Rodrigues -- View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-make-symbolizers-use-attribute-values-in-OpenLayers-Layer-WMS-tp5207043.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users