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

Arnd Wippermann arnd.wippermann at web.de
Mon Jul 18 12:17:07 EDT 2011


Hi,

As far as I know you can't load data with OpenLayers.Format.SLD(url). You
have to do it with an ajax call, i.e LoadUrl.

Arnd

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von gbrun
Gesendet: Montag, 18. Juli 2011 12:32
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Call a SLD file for a Vector Layer

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/
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



More information about the Users mailing list