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: [email protected] [mailto:[email protected]] Im
Auftrag von Dheeraj Chand
Gesendet: Donnerstag, 15. Juli 2010 21:36
An: [email protected]
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
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to