hi, 
I do something similar in http://edit.csic.es/edit_geo/prototype/edit.html ; 

I've never used (even don't know if it works)
config.loadModel("mySLD","pathtosld"); instead of that I change the mySLD
model (points to a dynamically generated SLD by PHP), saveModel and refresh.
You can do something similar but changing values of a SLD inserted in the
WebMap Context.

<model>
<StyledLayerDescriptor id="mySLD"> 
                  <defaultModelUrl>path to a generated SLD; the point layer 
points
to this SLD in the WMC</defaultModelUrl>
                <tools>
                    <EditSLD id="editSLD">
                        <targetModel>mainMap</targetModel>               
                    </EditSLD>
                </tools>
            </StyledLayerDescriptor>
</model>

from javascript...

xpath="//sld:Rule["+i+"]/sld:PointSymbolizer/sld:Graphic/sld:Mark/sld:Fill/sld:[EMAIL
 PROTECTED]'fill']/ogc:Literal";
SizeNode=config.objects.mySLD.doc.selectSingleNode(""+xpath+"").firstChild;

config.objects.mySLD.saveModel(config.objects.mySLD);
config.objects.mainMap.setParam("refresh")

I've posted some messages before in the mailing list. You can also check the
code in http://dev.e-taxonomy.eu/trac/browser/trunk/geo/mapviewer  (not very
well documented!)

hope it helps,

Pere Roca


Simms,Richard [Burlington] wrote:
> 
> Hello,
> 
> I am new to Mapbuilder (currently using 1.5-rc2). By following the
> included examples I've managed to get a working map with a bunch of
> widgets, a couple of my own javascript buttons, and several layers. Now
> I'm looking for a way to change SLD associated with a layer on the map.
> 
> Some background on what I'm trying to do: I've got a SQL database that
> is serving up points in lat-long that are placed one the map. The other
> layers are all polygon or raster. I'm colouring the SQL layer based on
> the ID numbers of the points. I'd like to colour the SQL points
> differently based on selections made on the map page.  
> 
>>From looking at the list archives I've come across the dynamic SLD
> manipulation thread. It looks like you can do
> config.loadModel("mySLD","pathtosld"). When I try to use this in Firebug
> it comes up with an error. Is there some place I can look to find
> information about how to use this properly? I suspect I'm not naming
> "mySLD" correctly.
> 
> There was an old thread and a couple of examples on the layers hiding
> problem.:
> config.objects.mainMap.getLayer('ROADL_TRANS_1M:Foundation').setAttribut
> e('hidden','1')
> config.objects.mainMap.setParam('refresh')
> Could a similar method be used to change the SLD?
> 
> If it isn't possible I can always generate a custom context file on the
> webserver and use loadModel to point to the new context.
> 
> Thanks,
> 
> Sincerely,
> Richard
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Mapbuilder-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mapbuilder-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Changing-SLD%27s-tp17602076p17642555.html
Sent from the MapBuilder Users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Mapbuilder-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mapbuilder-users

Reply via email to