Attila,

You can pass a scale parameter with your GetLegendGraphic request (e.g. 
"&SCALE=100000"), which would only return the matched rules (in this case your 
"Title" rule).

See here for more details: 
http://docs.geoserver.org/stable/en/user/services/wms/get_legend_graphic/legendgraphic.html

Regards,

Rob

From: Attila Berenyi [mailto:[email protected]]
Sent: 02 September 2013 11:53
To: [email protected]
Subject: [Geoserver-users] GetLegendGraphic - exclude SLD rule

Hi there,

I was wondering if there is an easy way to exclude a rule from the 
GetLegendGraphic request?

In this particular case I have two rules with different scale denominators - 
one for the actual data and one for the labels - and I'd like to totally 
exclude the labels from the result of GetLegendGraphic.

SLD as follows:
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor xmlns:xlink='http://www.w3.org/1999/xlink' 
xmlns:gml='http://www.opengis.net/gml' xmlns:ogc='http://www.opengis.net/ogc' 
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' version='1.0.0' 
xsi:schemaLocation='http://www.opengis.net/sld StyledLayerDescriptor.xsd' 
xmlns='http://www.opengis.net/sld' >
  <NamedLayer>
    <Name>Name</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <Title>Title</Title>
          <MaxScaleDenominator>3466752</MaxScaleDenominator>
          <PolygonSymbolizer>
            <Stroke>
              <CssParameter name="stroke" >#686868</CssParameter>
              <CssParameter name="stroke-width" >1</CssParameter>
              <CssParameter name="stroke-opacity" >0.5</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>
        <Rule>
          <Title>Label</Title>
          <MinScaleDenominator>110000</MinScaleDenominator>
          <MaxScaleDenominator>3466752</MaxScaleDenominator>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>label</ogc:PropertyName>
            </Label>
            <Font>
              <CssParameter name="font-family">Arimo</CssParameter>
              <CssParameter name="font-size">8</CssParameter>
              <CssParameter name="font-style">normal</CssParameter>
              <CssParameter name="font-weight">bold</CssParameter>
            </Font>
            <LabelPlacement>
              <PointPlacement>
                <AnchorPoint>
                  <AnchorPointX>0.5</AnchorPointX>
                  <AnchorPointY>0.5</AnchorPointY>
                </AnchorPoint>
                <Displacement>
                  <DisplacementX>0</DisplacementX>
                  <DisplacementY>0</DisplacementY>
                </Displacement>
              </PointPlacement>
            </LabelPlacement>
            <Halo>
              <Radius>1</Radius>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
                <CssParameter name="fill-opacity">1</CssParameter>
              </Fill>
            </Halo>
            <Fill>
              <CssParameter name="fill">#404040</CssParameter>
            </Fill>
          </TextSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

Cheers,
Attila

DISCLAIMER: The information contained in this communication/message from 
[email protected] sent on Mon Sep  2 12:37:26 2013 is confidential 
and may be legally privileged. It is intended solely for the addressee(s) 
[email protected];[email protected]

Access to this message by anyone else is unauthorised. If you are not the 
intended recipient, any disclosure, copying, or distribution of the message, or 
any action or omission taken by you in reliance on it, is prohibited and may be 
unlawful.
As a public body, Salford City Council may be required to disclose this email 
[or any response to it] under the Freedom of Information Act 2000, unless the 
information in it is covered by one of the exemptions in the Act.
Please immediately contact the sender, [email protected] if you 
have received this message in error.

For the full disclaimer please access http://www.salford.gov.uk/e-mail.  Thank 
you.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to