I think you got your examples backwards?

The SLD parameter is used to pass a style that completely defines a map
including listing all of the layers. To make this work your layers
eea-urban-atlas etcc.. should be documented as user layers in your SLD file.

Try removing the layers parameter, encode the SLD url value, and try again?

Actually checking the URL it redirects to
https://raw.githubusercontent.com/dzelge/test-gha/main/ljubilana.sld ... so
using that:

https://stage.xcube-geodb.brockmann-consult.de/geoserver/eea-urban-atlas/wms?service=WMS&version=1.1.0&request=GetMap&bbox=4638735.0%2C2524481.25%2C4704972.5%2C2594978.75&width=721&height=768&srs=EPSG%3A3035&format=image/png&SLD=https%3A%2F%2Fraw.githubusercontent.com%2Fdzelge%2Ftest-gha%2Fmain%2Fljubilana.sld

The result is: *Error while getting SLD.  See the log for details. *

I guess the next step is to check those logs.

For a working example testing locally
*https://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&SLD=http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fstyles%2Fnavigation.sld&bbox=-180.0,-90.0,180.0,90.0&width=768&height=384&srs=EPSG:4326&format=application/openlayers
<https://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&SLD=http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fstyles%2Fnavigation.sld&bbox=-180.0,-90.0,180.0,90.0&width=768&height=384&srs=EPSG:4326&format=application/openlayers>*


This has no layers parameter listed in the URL, instead the map pulls its
layers from a document like *navigation.sld* like:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld";
xmlns:ogc="http://www.opengis.net/ogc";
  xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
  xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd";>

  <NamedLayer>
    <Name>ne:states_provinces_scale</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Title>Administration Boundary</Title>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">
                <ogc:Literal>#f0f0C0</ogc:Literal>
              </CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">
                <ogc:Literal>#cccccc</ogc:Literal>
              </CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
  <NamedLayer>
    <Name>ne:roads</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Title>Roads</Title>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">
                <ogc:Literal>#AA3333</ogc:Literal>
              </CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
--
Jody Garnett


On Fri, 25 Jun 2021 at 04:23, Helge Dzierzon <
helge.dzier...@brockmann-consult.de> wrote:

> Hi There,
>
>
> I have an issue with using the parameter SLD in GetMap when using the WMS 
> service via the geoserver's API. When passing a style into the parameters of 
> a GET call to a WMS layer using the STYLES parameter I get the desired 
> result. However, when I copy and paste the sld code into a file on GitHub and 
> use the SLD parameter accordingly, everything is grey.
>
>
> Any idea?
>
>
> Geoserver version: 2.19.1
>
>
> Using parameter styles: 
> https://stage.xcube-geodb.brockmann-consult.de/geoserver/eea-urban-atlas/wms?service=WMS&version=1.1.0&request=GetMap&layers=eea-urban-atlas%3Aeea-urban-atlas_SI001L2_LJUBLJANA_UA2018&bbox=4638735.0%2C2524481.25%2C4704972.5%2C2594978.75&width=721&height=768&srs=EPSG%3A3035&format=image/png&SLD=https://github.com/dzelge/test-gha/blob/main/ljubilana.sld?raw=true
>
> Using parameter SLD: 
> https://stage.xcube-geodb.brockmann-consult.de/geoserver/eea-urban-atlas/wms?service=WMS&version=1.1.0&request=GetMap&layers=eea-urban-atlas%3Aeea-urban-atlas_SI001L2_LJUBLJANA_UA2018&bbox=4638735.0%2C2524481.25%2C4704972.5%2C2594978.75&width=721&height=768&srs=EPSG%3A3035&styles=ljubilana&format=image/png
>
> Style: https://github.com/dzelge/test-gha/blob/main/ljubilana.sld?raw=true
>
>
> Thanks
>
> _______________________________________________
> Geoserver-users mailing list
>
> Please make sure you read the following two resources before posting to
> this list:
> - Earning your support instead of buying it, but Ian Turton:
> http://www.ianturton.com/talks/foss4g.html#/
> - The GeoServer user list posting guidelines:
> http://geoserver.org/comm/userlist-guidelines.html
>
> If you want to request a feature or an improvement, also see this:
> https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer
>
>
> Geoserver-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>
_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to