It's work I make this:<br><br>function createSLD(layer){<br> var rules=[];<br> for(var i=0;i<layer.styleMap.styles.default.rules.length;i++){<br> rules[i]=layer.styleMap.styles.default.rules[i];<br>
}<br> var defaultStyle = new OpenLayers.Style("default", {<br> rules: rules,<br> name:"default",<br> isDefault:true<br> });<br>
rules=[];<br> for(var i=0;i<layer.styleMap.styles.select.rules.length;i++){<br> rules[i]=layer.styleMap.styles.select.rules[i];<br> }<br> var selectStyle = new OpenLayers.Style("select", {<br>
rules: rules,<br> name:"select",<br> });<br><br> var sld = new OpenLayers.Format.SLD().write({<br> namedLayers: [{<br> name: <a href="http://layer.name">layer.name</a>,<br>
userStyles: [defaultStyle,selectStyle]<br> }]<br> });<br> return sld;<br> }<br><br>Just a little problem : I use externalGraphics for Point and size is by default to 6? How can I specify the size of externalGraphics?<br>
<br>Thanks for help.<br><br>Jim<br clear="all"><br><pre>The StyleMap is no 1:1 representation of an SLD document. So you would<br>e.g. have to do the following:<br><br>var rule = new OpenLayers.Rule({<br> filter: yourFilter<br>
});<br>rule.symbolizer[yourGeometryType(point|line|polygon)] = yourSymbolizer;<br>var style = new OpenLayers.Style("", {rules: [rule]});<br>var sld = new OpenLayers.Format.SLD().write({<br> namedLayers: [{<br>
name: yourLayer.name,<br> userStyles: [style]<br> }]<br>});<br></pre><br>-- <br>Aumard Jimmy<br>Développeur - <a href="http://www.kinaxia.fr">http://www.kinaxia.fr</a><br>