[mapserver-users] SLD with LayerFeatureConstraints
Kralidis,Tom [Ontario]
Tom.Kralidis at ec.gc.ca
Mon Sep 12 07:56:33 PDT 2011
> -----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"
> xmlns:deegreeogc="http://www.deegree.org/ogc"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:ogc="http://www.opengis.net/ogc"
> xmlns:sld="http://www.opengis.net/sld"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:se="http://www.opengis.net/se" version="1.0.0">
> <sld:NamedLayer xmlns="http://www.opengis.net/sld">
> <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"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/sld
http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<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