[OpenLayers-Users] Call a SLD file for a Vector Layer

gbrun gbrun at myopera.com
Mon Jul 18 06:32:04 EDT 2011


Hi list!

I would like to apply SLD styles to my vector layers. It should work like  
in this example : http://www.openlayers.org/dev/examples/sld.html

But what I want to do is a little bit different: each layer has its own  
style. So I want that each vector layer calls its default style from a  
folder in my web application where styles are stored with the same name as  
their specific layer. For example, my application has a vector layer named  
"vector". In this case, this layer must called a SLD file named  
"vector.xml".

The OpenLayers example uses a "OpenLayers.LoadURL()" method. I'm looking  
for a different way: I would like to read the SLD response without this  
method. It should look like this:

var url_sld = "../sld/"+featureType.name+".xml";
			var format_sld = new OpenLayers.Format.SLD(url_sld);
			
			processResponse : function (response){
				var sld = format_sld.read(response.responseXML ||  
response.responseText);					
			};

But it doesn't work. I think, there is something that I don't understand  
when I read the SLD response.

Can someone clarify me this?

Geoffrey


-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Users mailing list