4

I have published a point layer in Geoserver, which is the data from a GPS Survey. In addition to the geometry, my layer, also contains an Attribute for Accuracy, which indicates the Accuracy in meters of the reading.

I have been trying to style the layer, such that a point is show as a point surrounded by a circle whose radius is equivalent to the Accuracy in map units. (Similar to how most mobile apps show the GPS points)

All of the Attribute based symbolization that I have seen is Rule based (i.e. Classification).

How do you Symbolize a point, such that its radius is equal to its accuracy?

7

Try an SLD like this, using ogc:PropertyName to include the accuracy value:

<?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>Attribute-based point</Name>
    <UserStyle>
      <FeatureTypeStyle>
        <Rule>
          <PointSymbolizer uom="http://www.opengeospatial.org/se/units/metre">
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#0033CC</CssParameter>
                  <CssParameter name="fill-opacity">0.1</CssParameter>
                </Fill>
              </Mark>
              <Size><ogc:PropertyName>Accuracy</ogc:PropertyName></Size>
            </Graphic>
          </PointSymbolizer>
          </PointSymbolizer>
            <PointSymbolizer>
             <Graphic>
               <Mark>
                <WellKnownName>circle</WellKnownName>
                 <Fill>
                  <CssParameter name="fill">#f00000</CssParameter>
                  <CssParameter name="fill-opacity">1.0</CssParameter>
                 </Fill>
               </Mark>
               <Size>7</Size>
               </Graphic>
            </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
1

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.