[mapserver-users] SLD with LayerFeatureConstraints

Kralidis,Tom [Ontario] Tom.Kralidis at ec.gc.ca
Tue Sep 13 07:36:31 EDT 2011


At thispoint, filtering is only supported via UserStyle.  Having said
this, please submit a trac ticket for the requirement.  Not sure when/if
it would be addressed.

..Tom


> -----Original Message-----
> From: Meine Toonen [mailto:meinetoonen at b3partners.nl]
> Sent: Tuesday, 13 September 2011 05:56
> To: Kralidis,Tom [Ontario]; mapserver-users at lists.osgeo.org
> Subject: RE: [mapserver-users] SLD with LayerFeatureConstraints
> 
> Thanks for the info.
> Will the LayerFeatureConstraints options be available in the future,
or is
> filtering only supported in an UserStyle? Couldn't find it in the
trac.
> 
> Met vriendelijke groet,
> 
> Meine Toonen
> B3Partners BV
> Tel: 030 214 2083
> 
> 
> ________________________________
> 
> 	From: Kralidis,Tom [Ontario] [mailto:Tom.Kralidis at ec.gc.ca]
> 	To: Meine Toonen [mailto:meinetoonen at b3partners.nl], mapserver-
> users at lists.osgeo.org
> 	Sent: Mon, 12 Sep 2011 16:56:33 +0200
> 	Subject: RE: [mapserver-users] SLD with LayerFeatureConstraints
> 
> 
> 
> 	> -----Original Message-----
> 	> From: mapserver-users-bounces at lists.osgeo.org
[mailto:mapserver-
> users-
> 	> bounces at lists.osgeo.org] On Behalf Of Meine Toonen
> 	> Sent: Monday, 12 September 2011 10:22
> 	> To: mapserver-users at lists.osgeo.org
> 	> Subject: [mapserver-users] SLD with LayerFeatureConstraints
> 	>
> 	> Hi list,
> 	>
> 	> I'm currently trying to filter features from a layer via a
SLD, but
> 	using
> 	> the style defined by the service. I managed to get a
NamedStyle by
> 	defining
> 	> a classgroup and assigning the class with the group.
> 	>
> 	> When I set the style via SLD to mv2, it works perfectly, but
when I
> 	add the
> 	> filterpart (LayerFeatureConstraints) it fails: the default
style is
> 	used
> 	> and no filtering occurs.
> 	>
> 	> Am I doing something wrong, of is filtering nog possible via
> 	> LayerFeatureConstraints?
> 	>
> 	> Mapfile:
> 	>
> 	> layer
> 	> name telpunten_motorvoertuig_punt
> 	> CLASSGROUP "mv"
> 	> metadata
> 	> "wms_title" "telpunten_points"
> 	> "gml_include_items" "all"
> 	> "wfs_featureid" "id"
> 	> end
> 	> group telpunten
> 	> status off
> 	> type point
> 	> dump true
> 	> template bla
> 	> connectiontype postgis
> 	> connection CONNECTIONSTATEMENT
> 	> data "locatie from (select id, nummer, locatie,
> 	> coalesce(soort,'Onbekend') as wb_soort, wegnummer from telpunt
) as
> 	foo
> 	> using srid=28992 using unique id"
> 	> projection
> 	> "init=epsg:28992"
> 	> end
> 	> classitem wb_soort
> 	>
> 	> class
> 	> NAME "motorvoertuig"
> 	> group "mv"
> 	> expression "MOTORVOERTUIG"
> 	> style
> 	>
> 	> symbol "square"
> 	> color 0 204 204
> 	> outlinecolor 0 0 0
> 	> size 8
> 	> end
> 	> end
> 	>
> 	> class
> 	> NAME "motorvoertuig2"
> 	> group "mv2"
> 	> expression "MOTORVOERTUIG"
> 	> style
> 	>
> 	> symbol "square"
> 	> color 255 0 0
> 	> outlinecolor 0 0 0
> 	> size 8
> 	> end
> 	> end
> 	>
> 	>
> 	> processing "CLOSE_CONNECTION=DEFER"
> 	> end
> 	>
> 	> The SLD:
> 	> <?xml version="1.0" encoding="UTF-8"?>
> 	>
> 	> <sld:StyledLayerDescriptor
xmlns:app="http://www.deegree.org/app"
> <http://www.deegree.org/app%22>
> 	> xmlns:deegreeogc="http://www.deegree.org/ogc"
> <http://www.deegree.org/ogc%22>
> 	> xmlns:gml="http://www.opengis.net/gml"
> <http://www.opengis.net/gml%22>
> 	> xmlns:ogc="http://www.opengis.net/ogc"
> <http://www.opengis.net/ogc%22>
> 	> xmlns:sld="http://www.opengis.net/sld"
> <http://www.opengis.net/sld%22>
> 	> xmlns:xlink="http://www.w3.org/1999/xlink"
> <http://www.w3.org/1999/xlink%22>
> 	> xmlns:se="http://www.opengis.net/se"
<http://www.opengis.net/se%22>
> version="1.0.0">
> 	> <sld:NamedLayer xmlns="http://www.opengis.net/sld"
> <http://www.opengis.net/sld%22> >
> 	> <se:Name>telpunten_motorvoertuig_punt</se:Name>
> 	> <sld:NamedStyle>
> 	> <se:Name>mv</se:Name>
> 	> </sld:NamedStyle>
> 	> <sld:LayerFeatureConstraints>
> 	> <Fsld:eatureTypeConstraint>
> 	> <ogc:Filter>
> 	> <ogc:PropertyIsEqualTo>
> 	> <ogc:PropertyName>wegnummer</ogc:PropertyName>
> 	> <ogc:Literal>A28</ogc:Literal>
> 	> </ogc:PropertyIsEqualTo>
> 	> </ogc:Filter>
> 	> </sld:FeatureTypeConstraint>
> 	> </sld:LayerFeatureConstraints>
> 	> </sld:NamedLayer>
> 	> </sld:StyledLayerDescriptor>
> 	>
> 	>
> 	> Thanks in advance!
> 	>
> 
> 	Sld:LayerFeatureConstraints is not supported by MapServer, or
SLD
> 1.0.0.
> 	FYI here's an example of applying filters to SLD:
> 
> 	<StyledLayerDescriptor version="1.0.0"
> 	xmlns="http://www.opengis.net/sld"
<http://www.opengis.net/sld%22>
> 	xmlns:ogc="http://www.opengis.net/ogc"
> <http://www.opengis.net/ogc%22>
> 	xmlns:xlink="http://www.w3.org/1999/xlink"
> <http://www.w3.org/1999/xlink%22>
> 
> 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> <http://www.w3.org/2001/XMLSchema-instance%22>
> 	xsi:schemaLocation="http://www.opengis.net/sld
> 	http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd"
> <http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd%22> >
> 	<Name>ms_ogc_workshop</Name>
> 	<Title>SLD for MapServer OGC Web Services Workshop</Title>
> 	<Abstract>This is an SLD to show how one can make a custom style
> 	without having to change the data style at the
server-side</Abstract>
> 	<NamedLayer>
> 	<Name>rivers</Name>
> 	<UserStyle>
> 	<Name>sld_01</Name>
> 	<Title>sld_01</Title>
> 	<IsDefault>1</IsDefault>
> 	<FeatureTypeStyle>
> 	<Rule>
> 	<ogc:Filter>
> 	<ogc:PropertyIsEqualTo>
> 
> 	<ogc:PropertyName>NAME</ogc:PropertyName>
> 
> 	<ogc:Literal>Japura</ogc:Literal>
> 	</ogc:PropertyIsEqualTo>
> 	</ogc:Filter>
> 	<LineSymbolizer>
> 	<Stroke>
> 	<CssParameter
> 	name="stroke">#FFCC00</CssParameter>
> 	<CssParameter
> 	name="stroke-width">5</CssParameter>
> 	</Stroke>
> 	</LineSymbolizer>
> 	</Rule>
> 	</FeatureTypeStyle>
> 	</UserStyle>
> 	</NamedLayer>
> 	</StyledLayerDescriptor>
> 



More information about the mapserver-users mailing list