[Geoserver-users] include external SLD

Hi

I use the geoserver for a weather project, and since 2 days I am trying to use external SLD.

In the documentation (http://geoserver.org/display/GEOSDOC/SLD+Intro+Tutorial) I read about 2 ways to realize it.

  1. To include it as POST Variable (&sld=urlto.sld

  2. In the OpenLayer definition

// setup untiled layer

untiled = new OpenLayers.Layer.WMS.Untiled(

“sf:dem”, “http://195.1.161.164:8080/geoserver/wms”,

{

height: ‘552’,

width: ‘800’,

layers: ‘sf:dem’,

styles: ‘’,

srs: ‘EPSG:26713’,

sld: ‘http://localhost/mysldfile.sld’,

format: ‘image/png’

},

{maxExtent: bounds, maxResolution: 74.1796875, projection: “EPSG:26713”}

);

I tested it with a geoserver on linux( Version 1.73 and 1.74 and both doesn’t work

Actual my SLD only work if i paste it with the Style Editor

I need only a way, without post the sld in the geoserver interphase(Styles) and without reload the server

Or should I use it with a database solution?

My example is on:

http://81.31.132.74:8081/geoserver/wms?bbox=450344.9587958323,55225.699580058084,864725.7694390065,325778.39296580886&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:shape_CH&width=800&height=490&srs=EPSG:4151

with sld i used following url

http://81.31.132.74:8081/geoserver/wms?bbox=450344.9587958323,55225.699580058084,864725.7694390065,325778.39296580886&sld=http://login.comventus.com/sld/shape_CH_style.sld&styles=&Format=application/openlayers&request=GetMap&version=1.1.1&layers=topp:shape_CH&width=800&height=490&srs=EPSG:4151

my url to my sld = http://login.comventus.com/sld/shape_CH_style.sld

Thank you

Guido Schratzer

E-Mail-Nachricht wurde von Internet Security ?berpr?ft (6.0.1.440)
Datenbankversion: 6.12500
http://www.pctools.com/internet-security/

Guido Schratzer ha scritto:

Hi

I use the geoserver for a weather project, and since 2 days I am trying to use external SLD.

In the documentation (http://geoserver.org/display/GEOSDOC/SLD+Intro+Tutorial) I read about 2 ways to realize it.

1. To include it as POST Variable (&sld=urlto.sld

2. In the OpenLayer definition

// setup untiled layer

          untiled = new OpenLayers.Layer.WMS.Untiled(

            "sf:dem", "http://195.1.161.164:8080/geoserver/wms",

            {

              height: '552',

              width: '800',

              layers: 'sf:dem',

              styles: '',

              srs: 'EPSG:26713',

              sld: 'http://localhost/mysldfile.sld’,

              format: 'image/png'

            },

            {maxExtent: bounds, maxResolution: 74.1796875, projection: "EPSG:26713"}

          );

I tested it with a geoserver on linux( Version 1.73 and 1.74 and both doesn’t work

Using a SLD within a request requires some matching between the
SLD and the layer.
It's been a while since I last played with external SLD, but as
far as I rember you have to give the NamedLayer the proper name: <Name>topp:shape_CH</Name>
and then either:
- mark the style as the default one (<UserStyle> should
   have <default>true</default> element)
- give the user style a name and refer to it in your request
   (&sld=...&styles=styleName).

As a final alternative, don't mention neither the layer names
and styles in the GetMap request and put everything in the SLD
with proper names.

Hope this helps

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Hi Andrea,
thank you very much!

The external SLD now working:
The Problem was
1. in the url i can't use the Port 8001
2. <Name>topp:shape_CH</Name> // name topp:shape_CH (Layername)

Best regards
Guido

-----Ursprüngliche Nachricht-----
Von: Andrea Aime [mailto:aaime@anonymised.com]
Gesendet: Freitag, 29. Mai 2009 18:33
An: Guido Schratzer
Cc: geoserver-users@lists.sourceforge.net
Betreff: Re: [Geoserver-users] include external SLD

Guido Schratzer ha scritto:

Hi

I use the geoserver for a weather project, and since 2 days I am trying
to use external SLD.

In the documentation
(http://geoserver.org/display/GEOSDOC/SLD+Intro+Tutorial) I read about 2
ways to realize it.

1. To include it as POST Variable (&sld=urlto.sld

2. In the OpenLayer definition

// setup untiled layer

          untiled = new OpenLayers.Layer.WMS.Untiled(

            "sf:dem", "http://195.1.161.164:8080/geoserver/wms&quot;,

            {

              height: '552',

              width: '800',

              layers: 'sf:dem',

              styles: '',

              srs: 'EPSG:26713',

              sld: 'http://localhost/mysldfile.sld’,

              format: 'image/png'

            },

            {maxExtent: bounds, maxResolution: 74.1796875, projection:
"EPSG:26713"}

          );

I tested it with a geoserver on linux( Version 1.73 and 1.74 and both
doesn't work

Using a SLD within a request requires some matching between the
SLD and the layer.
It's been a while since I last played with external SLD, but as
far as I rember you have to give the NamedLayer the proper name:
<Name>topp:shape_CH</Name>
and then either:
- mark the style as the default one (<UserStyle> should
   have <default>true</default> element)
- give the user style a name and refer to it in your request
   (&sld=...&styles=styleName).

As a final alternative, don't mention neither the layer names
and styles in the GetMap request and put everything in the SLD
with proper names.

Hope this helps

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.