Hi all,
I have a WMS GetMap requests that specifies an external SLD:
http://localhost:8080/geoserver/wms?LAYERS=west%3Afeatures&TRANSPARENT=TRUE&FORMAT=image%2Fpng&SLD=http%3A%2F%2Flocalhost%3A8080%2Fwest-webapp%2Fstyles%2Fwest-style.sld&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-41,31.75,49,76.75&WIDTH=1600&HEIGHT=800
Under geoserver-1.5.x (with x up to and including 4a) my features were
correctly styled according to the external SLD.
With 1.6.0-beta4 my SLD is ignored and the GeoServer default style for
that particular featureType (which happens to be poi.sld) is applied.
Why is that?
Regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600
On Thu, November 8, 2007 4:02 pm, Gertjan van Oosten wrote:
Hi all,
I have a WMS GetMap requests that specifies an external SLD:
http://localhost:8080/geoserver/wms?LAYERS=west%3Afeatures&TRANSPARENT=TR
UE&FORMAT=image%2Fpng&SLD=http%3A%2F%2Flocalhost%3A8080%2Fwest-webapp%2Fs
tyles%2Fwest-style.sld&STYLES=&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&E
XCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-41,31.75
,49,76.75&WIDTH=1600&HEIGHT=800
Under geoserver-1.5.x (with x up to and including 4a) my features were
correctly styled according to the external SLD. With 1.6.0-beta4 my SLD is
ignored and the GeoServer default style for that particular featureType
(which happens to be poi.sld) is applied.
Why is that?
Because before 1.6.0-beta4 we did not implement the SLD specification
correctly, now we do. The spec says that in order to have your style be
used for a specific layer you have to:
* have a user layer that has the same name as your layer
* have a style inside that user layer that has been marked as the default one
Alternatively:
* have a user layer that has the same name as your layer
* use style=xxx where xxx is a name of a style inside the above user layer.
This is what the SLD specification say about the SLD used in library mode
(that's my understanding of it, at least).
Hmmm... I can see how this may be troublesome for people that used the old
un-compliant behaviour. Maybe I should re-instate it as a fallback (first
try the spec compliant path, if it fails fall back on the old behaviour).
Care to open a jira issue about this?
Cheers
Andrea
Because before 1.6.0-beta4 we did not implement the SLD specification
correctly, now we do. The spec says that in order to have your style be
used for a specific layer you have to: * have a user layer that has the
same name as your layer * have a style inside that user layer that has
been marked as the default one Alternatively:
* have a user layer that has the same name as your layer
That's what the spec says btw:
"To make the HTTP-GET methods more practical for use, the SLD can also be
used in
one of two different modes depending on whether the LAYERS parameter is
present in the
request. If it is not present, then all layers identified in the SLD
document are rendered
with all defined styles, which is equivalent to the XML-POST method of
usage. If the
LAYERS parameter is present, then only the layers identified by that
parameter are
rendered and the SLD is used as a “style library”.
When an SLD is used as a style library, the STYLES CGI parameter is
interpreted in the
usual way in the GetMap request, except that the handling of the style
names is organized
so that the styles defined in the SLD take precedence over the named
styles stored within
the map server. The user-defined SLD styles can be given names and they
can be marked
as being the default style for a layer. To be more specific, if a style named
“CenterLine” is referenced for a layer and a style with that name is
defined for the
corresponding layer in the SLD, then the SLD style definition is used.
Otherwise, the
standard named-style mechanism built into the map server is used. If the
use of a default
style is specified and a style is marked as being the default for the
corresponding layer in
the SLD, then the default style from the SLD is used; otherwise, the
standard default style
in the map server is used."
I checked the code, you can use either a user layer or a named layer to
host the styles.
Cheers
Andera
Hi Andrea,
As quoted from aaime@anonymised.com:
"To make the HTTP-GET methods more practical for use, the SLD can also be
used in one of two different modes [...]"
I checked the code, you can use either a user layer or a named layer to
host the styles.
I've read the above about ten times now, and I'm still uncertain about
the consequences. Under GeoServer pre-1.6, the request with the
parameters below works (some parameters left out for clarity):
/geoserver/wms?
LAYERS=west:features
SLD=http://localhost:8080/west-webapp/styles/west-style.sld
STYLES=
My SLD specifies a NamedLayer with Name=west:features which has a
UserStyle which has a FeatureTypeStyle which has two rules.
What does the request need to be under 1.6 for the result to be the same?
Please enlighten me.
Kind regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600
On Fri, November 9, 2007 3:58 pm, Gertjan van Oosten wrote:
Hi Andrea,
As quoted from aaime@anonymised.com:
"To make the HTTP-GET methods more practical for use, the SLD can also
be used in one of two different modes [...]"
I checked the code, you can use either a user layer or a named layer to
host the styles.
I've read the above about ten times now, and I'm still uncertain about
the consequences. Under GeoServer pre-1.6, the request with the parameters
below works (some parameters left out for clarity):
/geoserver/wms?
LAYERS=west:features
SLD=http://localhost:8080/west-webapp/styles/west-style.sld
STYLES=
My SLD specifies a NamedLayer with Name=west:features which has a
UserStyle which has a FeatureTypeStyle which has two rules.
What does the request need to be under 1.6 for the result to be the same?
Please enlighten me.
To make it work according to the specification you have to setup the sld
appropriately, that is:
* have a user or named layer whose name tag contains "west:features"
* have a style inside of it whose isDefault tag says "true"
I know the spec is convoluted... I'll reinstate back the old sloppy but
easy to understand behaviour as a fallback if the standard behaviour does
not find the style inside the SLD.
Cheers
Andrea
Hi Andrea,
As quoted from aaime@anonymised.com:
> My SLD specifies a NamedLayer with Name=west:features which has a
> UserStyle which has a FeatureTypeStyle which has two rules.
> What does the request need to be under 1.6 for the result to be the same?
> Please enlighten me.
To make it work according to the specification you have to setup the sld
appropriately, that is:
* have a user or named layer whose name tag contains "west:features"
* have a style inside of it whose isDefault tag says "true"
Right, that does the trick! I just needed an <IsDefault>true</IsDefault>
inside my <UserStyle>.
I know the spec is convoluted...
But that's not your fault, Andrea.
I'll reinstate back the old sloppy but easy to understand behaviour as
a fallback if the standard behaviour does not find the style inside
the SLD.
That would help me (and probably a lot more people).
Thanks for the quick response!
Regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600