Opened 19 years ago

Last modified 15 years ago

#1280 closed enhancement

support for named styles — at Version 5

Reported by: bartvde@… Owned by: mapserverbugs
Priority: high Milestone: FUTURE
Component: WMS Server Version: 4.8
Severity: minor Keywords:
Cc: sdlime, schuyler@…

Description (last modified by hobu)

Currently Mapserver does not support named styles. All styles defined in the MAP
file are default styles in WMS terms, requested with &styles= (empty style name).

If it would be possible to define styles in Mapserver (not attached to a layer),
styles could be re-used for layers. There is already a bug for that (812). Using
wms metadata somebody could advertize which named styles he would want to
include per layer.

I was also thinking if this might solve a problem I have been running into with
Chameleon. When drawing a selection, Chameleon needs to request 2 images (2
GetMap requests which can't be combined), one image showing the original map,
and one using an SLD to show the selection in red on top of the original map.

If we had named styles, could this not be done in one single GetMap request
instead of two, combining a NamedStyle and a UserStyle? Or is this not allowed
by the SLD spec?

Change History (5)

comment:1 by bartvde@…, 19 years ago

I just looked it up in the SLD spec, it is allowed to combine UserStyle and
NamedStyle, e.g.:

<StyledLayerDescriptorversion="1.0.0"><NamedLayer><Name>Roads</Name><UserStyle><FeatureStyleType><Rule><LineSymbolizer><Geometry><ogc:PropertyName>center-line</ogc:PropertyName></Geometry><Stroke><CssParametername="stroke">#aaaaff</CssParameter><CssParametername="stroke-width">5.0</CssParameter></Stroke></LineSymbolizer></Rule></FeatureTypeStyle></UserStyle><NamedStyle><Name>CenterLine</Name></NamedStyle></NamedLayer></StyledLayerDescriptor>

So we could already use the default NamedStyle to do a selection on a layer with
only 1 GetMap request, if Mapserver supports this in SLD already?

        <Style>
          <Name>default</Name>

comment:2 by assefa, 19 years ago

Bart,

 The support of "default" style was added to accomodate the GetLegendGraphic 
(Bug 1001). It does not do any style selection on the server side, specifying 
stles=default is equivallent to syles= (empty style name). (It does not 
through an excpetion and that is all)

 Named styles are not supported because the mapserver architectuire does not 
provide yet the capability to define on a layer a set of classes that are 
mutually exclusive and where one set of classes can be picked for rendering.
You mentionned Bug 812, and that could be a way to resolve this issue.

comment:3 by bartvde@…, 19 years ago

Milestone: FUTURE
Setting target to FUTURE.

comment:4 by crschmidt, 17 years ago

Old, old patch (5-2006) from Schuyler implementing named styles, which we just found when cleaning something up. Attaching patch here so it doesn't get lost. i think schuyler plans on doing some cleanup here, but at least it's here for the future regardless.

comment:5 by hobu, 17 years ago

Cc: sdlime added
Description: modified (diff)
Note: See TracTickets for help on using tickets.