Opened 19 years ago

Closed 15 years ago

#1280 closed enhancement (fixed)

support for named styles

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 (10)

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)

comment:6 by sderle, 17 years ago

Cc: schuyler@… added
Version: 4.44.8

The patch works slightly better if you run patch with -F3. The idea was to allow STYLE blocks at the top level of the map file, with NAME directives to assign names to them. Then, in the LAYER blocks, one would simply be able to say "STYLE stylename" instead of having a STYLE block. Additionally, I added the INHERITS directive, which imports the style definitions from a named style into the current STYLE block, making it possible to "subclass" named styles. Please let me know if this ticket needs any attention at all on my part to move forward. Thanks!

comment:7 by dmorissette, 17 years ago

I think we're mixing two things:

1- The original ticket was about supporting OGC SLD styles

2- Schuyler's patch seems to be about supporting named styles in a MapServer mapfile.

OGC styles and MapServer styles share a common name but are different beasts. If I'm not mistaken, an OGC style would be closer to a MapServer class, so supporting named styles means something different in both cases.

I suggest that Schuyler's patch should get its own ticket

comment:8 by dmorissette, 17 years ago

I have created ticket #2319 for Schuyler's patch.

comment:9 by nsavard, 15 years ago

Could we close this ticket since it was implemented as specified in http://mapserver.org/development/rfc/ms-rfc-39.html#rfc39?

comment:10 by bartvde, 15 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.