[OpenLayers-Users] Trying to troubleshoot a map: redrawing layerwith SLD style

Arnd Wippermann arnd.wippermann at web.de
Thu Jul 15 17:29:25 EDT 2010


Hi,
 
that's the way I write the SLD from a style:
 
function SLDwrite(namedLayer)
{
    var styleObj =
map.layers[map.aktLayer]["styleMap"]["styles"]["default"];
 
    var sld = {};
    sld["namedLayers"] = {};
    sld["namedLayers"][namedLayer] = {};
    sld["namedLayers"][namedLayer]["userStyles"] = [styleObj];
    sld["namedLayers"][namedLayer]["userStyles"][0].layerName = namedLayer;
    sld["namedLayers"][namedLayer]["namedStyles"] = [];
    sld["namedLayers"][namedLayer]["name"] = namedLayer;
    sld["version"] = "1.0.0";
 
    var formatSLD = new OpenLayers.Format.SLD();
    return(formatSLD.write(sld).replace(/\n/g,""));
}

Arnd

  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Dheeraj Chand
Gesendet: Donnerstag, 15. Juli 2010 21:36
An: users at openlayers.org
Betreff: [OpenLayers-Users] Trying to troubleshoot a map: redrawing
layerwith SLD style


Hi, everyone, 

I posted just the other day about a map that I'm building.  The idea has
been changed to a simpler one.  Through a form, the user constructs a
variable that represents the attribute to be considered, then a style is
built and attached to the layer in question and the layer is redrawn.  It
should be fairly simple, but my newness to JS and OpenLayers is getting in
the way.

I seem to have all kinds of problems with this map,1) For some reason,
battlegroundData is rendering as a base layer, not an overlay, 2) I think
that something is wrong with the projection and 3) I'm not sure whether I
read the documentation correctly for writing the style SLD and then
attaching it.  


Mind helping a brother meet his deadline?
http://gulfcoaststrategicservices.com/maps/lrp/index.html

Thanks,

Dheeraj
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100715/4b0a6571/attachment.html


More information about the Users mailing list