[OpenLayers-Users] Layer SLD param path (relative?)

Andreas Hocevar ahocevar at opengeo.org
Wed Apr 21 10:33:03 EDT 2010


Hi,

you may get a better reply on this on the GeoServer users list. But GeoServer supports file uris. So if you have your sld in /home/foo/styles/my.sld, your sld param in geoserver would be
&sld=file:///home/foo/styles/my.sld. By doing so, you don't need http to access your sld.

I am not aware of a path that you could access without specifying the whole path. If you want a shorter url, you could upload the style to geoserver (using either the gui or the restconfig api), and use &styles= instead of &sld=.

Regards,
Andreas.

On Apr 21, 2010, at 16:03 , Florent Gravin wrote:

> Hi,
> thks for reply,
> 
> so i have my wms server in http://localhost:8080/geoserver/wms
> 
> so, if i want to put a SLD relative path as "sld: './mySLD.sld'", i have to 
> put the mySLD.sld file somewhere in my geoserver directories... 
> (tomcat/webapps/geoserver).
> i tried in /geoserver but with no results.. i couldn't find where the alias 
> wms is configured, and the folder it's linked to..
> 
> thanks to guide me in which specific folder of geoserver i have to pu my SLD 
> file
> 
> regards,
> 
> flo
> 
> 
> ----- Original Message ----- 
> From: "Andreas Hocevar" <ahocevar at opengeo.org>
> To: "Florent Gravin" <florent.gravin at bluecham.net>
> Cc: <users at openlayers.org>
> Sent: Wednesday, April 21, 2010 3:41 PM
> Subject: Re: [OpenLayers-Users] Layer SLD param path (relative?)
> 
> 
> Hi,
> 
> On Apr 21, 2010, at 15:37 , Florent Gravin wrote:
> 
>> Hi,
>> 
>> i'm using param SLD like this :
>> 
>> wmsLayer = new OpenLayers.Layer.WMS( 'layer',
>> 'http://localhost:8080/geoserver/wms', {
>>  layers: 'ns:mylayer',
>>  transparent: true,
>>  sld: 'http://localhost/geo/mySLD.sld'
>> },{
>> transitionEffect: 'resize',opacity:1
>> }
>> );
>> 
>> it works fine, but only in the case where i specify full URL of the SLD 
>> (absolute path with http://..........).
>> i would like to specify a SLD with a relative path, like sld: 
>> '../geo/mySLD.sld' but it's not working
>> 
>> what is the base folder specify by "./" in the SLD param ? how could i get 
>> it with relative path ?
> 
> This sld is loaded and processed by your wms, not by OpenLayers. So a 
> relative path will only, if at all, work if your sld is on the filesystem of 
> the wms.
> 
> Regards,
> Andreas.
> 
>> thanks for help
>> 
>> flo
>> 
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
> 
> 
> 
> -- 
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.




More information about the Users mailing list