SLD Filter Using Default Mapfile Rendering

John Fletcher jfletcher at LATITUDEGEO.COM
Fri Dec 3 15:06:06 EST 2004


I would like to file an enhancement request for this, but I'm looking
for feedback from Mapserver users / developers before doing so in case
my suggestion goes against the SLD spec in some way or simply wouldn't
work programmatically for some other reason.

Here's my case:
The SLD spec suggests that the Symbolizer element is optional inside a
Rule, but doesn't specify what the behaviour should be if no Symbolizer
is specified.  Currently Mapserver does not draw features if there is no
Symbolizer present.  While this can be a handy method of filtering out
features that you *don't* want displayed, you can accomplish the same
thing by making sure these features don't have any matching Rules
(according to the Filter).

If Mapserver interpreted a Rule with no associated Symbolizer elements
as an instruction to draw all features matching the Filter in the
default rendering specified in the mapfile, a client could filter out
unwanted features without needing to know anything about how the layer
is styled in the mapfile.  This becomes extremely useful in cases where
the mapfile defines upwards of 40 classes with different rendering based
on the value of a particular attribute.  In addition, "highlighting"
certain features could be accomplished by sending an SLD with an
appropriate Filter and "highlight" rendering specified (yellow, bright
blue a la ArcMap, etc), then just putting in another Rule with an
ElseFilter and no Symbolizer:

<Rule>
    <Filter>
        <PropertyIsEqualTo>
            <PropertyName>FIELD_NAME</PropertyName>
            <Literal>FIELD_VALUE</Literal>
        </PropertyIsEqualTo>
    </Filter>
    <PointSymbolizer>
        <Graphic>
            <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                    <CssParameter name="fill">#00ffff</CssParameter>
                </Fill>
            </Mark>
            <Size>4.0</Size>
        </Graphic>
    </PointSymbolizer>
</Rule>
<Rule>
    <ElseFilter/>
</Rule>

Does anyone have thoughts on the matter?

Thanks,

John

> -----Original Message-----
> From: UMN MapServer Users List 
> [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of 
> Yewondwossen Assefa
> Sent: Friday, December 03, 2004 9:02 AM
> To: MAPSERVER-USERS at LISTS.UMN.EDU
> Subject: Re: [UMN_MAPSERVER-USERS] SLD Filter Using Default 
> Mapfile Rendering
> 
> I haven't played much with the cgi but checking the code and 
> the docuementaion, I do not think that you can set any 
> metadata value from the cgi.
> 
> Kralidis,Tom [Burlington] wrote:
> >>-----Original Message-----
> >>From: UMN MapServer Users List
> >>[mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On Behalf Of John Fletcher
> >>Sent: Thursday, 02 December, 2004 17:54
> >>To: MAPSERVER-USERS at LISTS.UMN.EDU
> >>Subject: Re: [UMN_MAPSERVER-USERS] SLD Filter Using Default Mapfile 
> >>Rendering
> >>
> >>
> >>
> >>>What you could do is, if the data you're fetching is available as 
> >>>OGC:WFS, is use MapServer as a WFS client and apply the 
> filter at the 
> >>>mapfile (or dynamically generated) level and assume the same 
> >>>rendering as per mapfile.
> >>
> >>That's a really good idea - one I hadn't considered.  The 
> only problem 
> >>is that I need to be able to apply a filter dynamically through the 
> >>CGI interface (I'm assuming Mapserver doesn't expose any 
> CGI interface 
> >>to access the filter for WFS layers).
> >>
> >
> >
> > The filter in the LAYER/METADATA object is set as:
> >
> > "wfs_filter" "somefilterstring"
> >
> > ...which you could set via map_layername_wfs_filter (the developers 
> > can confirm this -- I'm guessing this is allowed.
> >
> > ..Tom
> >
> >
> >
> >>Has there ever been talk of the implementation of a 
> DefaultSymbolizer 
> >>in the SLD spec that would do this sort of thing?  I 
> suppose the SLD 
> >>spec could also just recommend a default action for a WMS 
> to take if 
> >>no Symbolizer is present.
> >> Of course, I could just be exposing my ignorance of the whole 
> >>subject...
> >>
> >>Thanks for the help.
> >>
> >>John
> >>
> >
> >
> >
> 
> 
> --
> ----------------------------------------------------------------
> Assefa Yewondwossen
> Software Analyst
> 
> Email: assefa at dmsolutions.ca
> http://www.dmsolutions.ca/
> 
> Phone: (613) 565-5056 (ext 14)
> Fax:   (613) 565-0925
> ----------------------------------------------------------------
> 



More information about the mapserver-users mailing list