[mapserver-dev] SLD rendering order of multiple rules in a single layer

Matthijs Laan matthijslaan at b3partners.nl
Tue Aug 2 07:54:35 EDT 2011


I have attached a patch that creates a maplayer for each NamedStyle or 
FeatureTypeStyle found in a SLD.

The biggest changes are in msSLDParseSLD(). msSLDParseNamedLayer() is 
split up into msSLDParseNamedStyle() and msSLDParseFeatureTypeStyle(), 
but most of the changed lines are removed spaces for indentation.

It leverages the changes in r11717 for supporting multiple NamedLayers 
with the same name. The effect of the patch is the same as if the SLD 
where transformed to move siblings of the first FeatureTypeStyle element 
to a separate NamedLayer with the same name.

Matthijs

On 2011-08-01 19:31, Matthijs Laan wrote:
> Hello!
>
> Reading the SLD spec OGC 02-070, on page 25 it says
>
>   "a map styler is expected to process all FeatureTypeStyles in the order
>    that they appear, regardless, plotting one instance over top of 
> another"
>
> Regarding Rules it says on page 26:
>
>   "stylers should attempt to render the higher-priority rules over top of
>    the lower-priority rules (exactly what this means is implementation-
>    specific)" (the first Rule has the highest priority)
>
> I guess you can interpret this that all features for a 
> FeatureTypeStyle should
> be drawn before features for a following FeatureTypeStyle element are 
> drawn.
> For multiple Rules this is less clear, but apparently similar although 
> with
> the order reversed.
>
> I have a single layer where one feature should be drawn on top of another
> using different styles (I cannot influence the ordering of the 
> features coming
> from the source).
>
> I would expect to realize this with two different Rule elements, where 
> the
> Rule for the feature I want drawn on top would appear later in the 
> document as
> child of a different FeatureTypeStyle or UserStyle element than the 
> first Rule
> (except when the two Rules have the same FeatureTypeStyle parent- 'on 
> top' Rule
> would be the first element).
>
> However I can only make this work when the 'draw-last' Rule is a 
> parent of
> another NamedLayer element with the same Name later in the SLD, per 
> the patch
> for ticket #1602 (r11717).
>
> I would like to have this work with a single NamedLayer. For GeoServer 
> having
> two FeatureTypeStyle elements under a single UserStyle works (but not 
> multiple
> NamedLayer/UserStyle elements or two Rules under a single 
> FeatureTypeStyle...).
>
> So working with 6.1-dev is:
> <StyledLayerDescriptor>
> <NamedLayer><Name>mylayer</Name>
> <UserStyle>...<FeatureTypeStyle>...<Rule><Name> bottom 
> </Name>...</Rule><//>
> </NamedLayer>
> <NamedLayer><Name>mylayer</Name>
> <UserStyle>...<FeatureTypeStyle>...<Rule><Name> top </Name>...</Rule><//>
> </NamedLayer>
> </StyledLayerDescriptor>
>
> I would like to have work:
> <StyledLayerDescriptor>
> <NamedLayer><Name>mylayer</Name>
> <UserStyle> ...
> <FeatureTypeStyle>...<Rule><Name> bottom </Name>...</Rule></>
> <FeatureTypeStyle>...<Rule><Name> top </Name>...</Rule></>
> </UserStyle>
> </NamedLayer>
> </StyledLayerDescriptor>
>
> My questions are:
> - Is my interpretation of the spec correct? Should this work?
> - Would a patch similar to r11717 but for multiple FeatureTypeStyles work
>   (inserting a new layer in the generated temporary mapfile?)
>
> I'll try to look into making a patch. I don't think it can be as 
> simple as r11717
> unfortunately... That patch adds a new mapfile layer with a generated 
> name and changes
> the duplicate SLD NamedLayer's Name to the generated name so the other 
> code isn't
> affected.
>
> Matthijs
>
>
> _______________________________________________
> mapserver-dev mailing list
> mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: maplayer_per_fts.patch
Type: text/x-patch
Size: 22731 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20110802/da9d1918/maplayer_per_fts.bin


More information about the mapserver-dev mailing list