The setup you have for your page appears similar to what I'm trying to do. However, I don't necessarily need to modify the SLD piece by piece. I was planning on switching between SLD's with something like:
http://localhost/sld.php?id=42&colour=12 http://localhost/sld.php?id=12&colour=1 Etc. The EditSLD class appears to be missing from 1.5(rc 2). Should I be using something a bit closer to the trunk? (I'm guessing the fact that I'm missing the EditSLD tool is the reason that my SLD's appear to be read only) I came across another idea: config.objects.mySLD.setModel('mySLD','http://localhost/basic_sld.xml') config.objects.mySLD.saveModel(config.objects.mySLD) But, after refreshing, there is no change in the map. --Richard -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of pere roca Sent: June 4, 2008 5:23 AM To: [email protected] Subject: Re: [Mapbuilder-users] Changing SLD's 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:Fi ll/sld:[EMAIL PROTECTED]'fill']/ogc:Literal"; SizeNode=config.objects.mySLD.doc.selectSingleNode(""+xpath+"").firstChi ld; 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 ------------------------------------------------------------------------- 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
