[OpenLayers-Users] sld_body with WMS

Wes Toews wolfsnipes at gmail.com
Wed May 28 12:12:10 EDT 2008


hi, I need to implement dynamic map colouring client-side with
javascript with sld_body in the layer declaration.  The concept is
that different polygons can be highlighted (well, shaded red or
something) based on input from a dropdown list or form or something.
I'm using OpenLayers with Geoserver 1.6.1.

what I have so far is..

var mysld = '<StyledLayerDescriptor version ="1.0.0" ...>...xml stuff
here...</StyledLayerDescriptor>';

var myLayer = new OpenLayers.Layer.WMS("MyLayer", "/geoserver/wms",
                {
                    height: '362',
                    width: '800',
                    layers: 'trsiLayers',
                    sld_body: mysld,
                    srs: 'EPSG:4326',
                    format: 'image/png'
                },
                {singleTile: true}
            );

after this, I get a blank map with no complaints from IE.  The SLD
itself should be fine as it's tested in Geoserver and works fine, it's
just when I write it in the web page that it doesn't render a map.  If
the sld_body is commented out everything shows up.  And please don't
point me to any existing posts unless you KNOW it is a good one.

thanks,

Daniel



More information about the Users mailing list