1

I am new to web mapping. I would like to create a SLD style that colours the points if they fall between certain numbers for example 0-500. I know I could manually create each colour for each value and assign it. However this is not practical when you reach high numbers of values that need colouring. One option is to group them into small groups of 10, but that still gives me 50 colours to do.

I have a few hundred points, served from GeoServer via WMS, that rance from 0-500.

How would I go about doing this with SLD? The image below shows an example of what I would expect in a desktop client.

Layer styling

2

Or look at the interpolate function: http://docs.geoserver.org/latest/en/user/styling/sld-tipstricks/transformation-func.html#interpolate

Mind, if you use it, GetLegendGraphics won't generate a nice legend for you (known limitation)

0

I would suggest to classify your points into groups. You can symbolize by attribute by assigning filters for each class and assigning the appropriate literal value or text. Then you just change the fill color for each literal/filter, e.g.

#778899

<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0" 
    xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd" 
    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">
  <NamedLayer>
    <Name>Project Tracker Status</Name>
    <UserStyle>

      <FeatureTypeStyle>
           <Rule>
             <Name>Project Tracker Status</Name>
             <Title>Assigned to Field Designer</Title>
             <MinScaleDenominator>13541</MinScaleDenominator>
             <MaxScaleDenominator>6.0E7</MaxScaleDenominator>

             <Filter>
               <PropertyIsEqualTo>
                 <PropertyName>status</PropertyName>
                 <Literal>Assigned to Field Designer</Literal>
               </PropertyIsEqualTo>
             </Filter>
             <PointSymbolizer>
                <Fill>
                    <CssParameter name="fill-opacity">0.5</CssParameter>
                    <CssParameter name="fill">#006400</CssParameter>
                </Fill>
             </PolygonSymbolizer>

           </Rule>

            <Rule>
             <Name>Project Tracker Status</Name>
             <Title>Awaiting Approval</Title>
             <MinScaleDenominator>13541</MinScaleDenominator>
             <MaxScaleDenominator>6.0E7</MaxScaleDenominator>

             <Filter>
               <PropertyIsEqualTo>
                 <PropertyName>status</PropertyName>
                 <Literal>Awaiting Approval</Literal>
               </PropertyIsEqualTo>
             </Filter>
             <PointSymbolizer>
                <Fill>
                    <CssParameter name="fill-opacity">0.5</CssParameter>
                    <CssParameter name="fill">#778899</CssParameter>
                </Fill>
             </PointSymbolizer>

           </Rule>

  </FeatureTypeStyle>
        </UserStyle>
      </NamedLayer>
    </StyledLayerDescriptor>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.