[OpenLayers-Users] Changing the style at runtime of the WMS

Lucas vargas eskopinski at gmail.com
Fri Nov 14 13:12:06 EST 2008


Hi,

I'm trying with this code:

basic_wms = new OpenLayers.Layer.WMS("topp:world", "
http://localhost:8888/geoserver/wms", {
            srs: 'EPSG:4326', transparent: 'true', layers: 'topp:world',
styles: '',
                format: format, tiled: 'true' }, {isBaseLayer: true},
{buffer: 0});

        map.addLayers([basic_wms]);
        map.zoomToMaxExtent();

        var stationStyles = new OpenLayers.StyleMap({ // This is only for
stations
                "default": new OpenLayers.Style({
                    fillColor: "#006699",
                    strokeColor: "#ff9933",
                    strokeWidth: 2,
                    fillOpacity: 0.6
                }),
                "select": new OpenLayers.Style({
                    fillColor: "#006699",
                    strokeColor: "#ff9933",
                    strokeWidth: 6,
                    fillOpacity: 1
                })
            });

basic_wms.mergeNewParams({ styles : stationStyles['select']});

but does not work: D

Can anybody help me?

Thanks.

Lucas Vargas Eskopinski.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081114/6e21fe31/attachment.html


More information about the Users mailing list