Smathermather's Weblog

Remote Sensing, GIS, Ecology, and Oddball Techniques

Complex Symbolization in GeoServer or Compass Rose Mania– the GeoServer Version

Posted by smathermather on November 30, 2011

At my place of employment, we have a vegetation survey program with enough potential plots to serve 50 years of data collection. The points are laid out in a Generalized Random Tessellation Stratified (GRTS) to maximize the statistical power of the analyses we do with them. Read more about GRTS. I dare you. Actually, it’s not so bad if you understand Quad-Trees and the like– it’s just a wicked clever way to ensure spatially-balanced random sampling in order to maximize power.

But GRTS is not the point. The point is that we wanted to show in a map a 40 ft meter buffer, with some cues for the cardinal directions for our field staff. We also wanted them to be able to make their own maps. Enter some funky complex symbolization with a dashed line for the buffer, and dots for the cardinal directions, kind of like thousands of compass roses across the landscape:

Compass Rose Mania-- the GeoServer Version

.

(BTW, find the flaw in this approach and you get my praise. That and a dollar will buy you a cup of coffee– hint: we’re working in a State Plane that is Lambert Conformal Conic).

SLD below:

<?xml version="1.0" encoding="ISO-8859-1"?>
<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">
  <NamedLayer>
    <Name>40 meter buffer</Name>
    <UserStyle>
      <Title>40 meter buffer</Title>
      <Abstract></Abstract>
      <FeatureTypeStyle>
        <Rule>
          <Title>40 meter buffer</Title>
          <Name>40 meter buffer</Name>
          <MaxScaleDenominator>100000</MaxScaleDenominator>
          <PolygonSymbolizer>
            <Geometry>
              <ogc:Function name="buffer">
                <ogc:PropertyName>the_geom</ogc:PropertyName>
                <ogc:Literal>131.2</ogc:Literal>
              </ogc:Function>
            </Geometry>
            <Stroke>
              <CssParameter name="stroke">#d3d3d3</CssParameter>
              <CssParameter name="stroke-width">2</CssParameter>
            <CssParameter name="stroke-dasharray">2 2</CssParameter>
            </Stroke>
          </PolygonSymbolizer>

          <PointSymbolizer>

            <Geometry>
               <ogc:Function name="offset">
                  <ogc:PropertyName>the_geom</ogc:PropertyName>
                  <ogc:Literal>0</ogc:Literal>
                 <ogc:Literal>131.2</ogc:Literal>
                 </ogc:Function>
            </Geometry>

            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#bebebe</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
       
          <PointSymbolizer>

            <Geometry>
               <ogc:Function name="offset">
                  <ogc:PropertyName>the_geom</ogc:PropertyName>
                  <ogc:Literal>0</ogc:Literal>
                 <ogc:Literal>-131.2</ogc:Literal>
                 </ogc:Function>
            </Geometry>

            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#bebebe</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
          
          <PointSymbolizer>

            <Geometry>
               <ogc:Function name="offset">
                  <ogc:PropertyName>the_geom</ogc:PropertyName>
                  <ogc:Literal>131.2</ogc:Literal>
                 <ogc:Literal>0</ogc:Literal>
                 </ogc:Function>
            </Geometry>

            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#bebebe</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
          
          <PointSymbolizer>

            <Geometry>
               <ogc:Function name="offset">
                  <ogc:PropertyName>the_geom</ogc:PropertyName>
                  <ogc:Literal>-131.2</ogc:Literal>
                 <ogc:Literal>0</ogc:Literal>
                 </ogc:Function>
            </Geometry>

            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#bebebe</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>          
          
          
        </Rule>

      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
</code></pre>


About these ads

5 Responses to “Complex Symbolization in GeoServer or Compass Rose Mania– the GeoServer Version”

  1. Gerry Tsui said

    isn’t it that at some very large scale zoom level. the 6 pixel circle itself can be larger than 40 meters ?

  2. Gerry Tsui said

    Also the stroke-width value of 2, can overshoot above the 40 meter as high zoom levels.

  3. Not too worried about the zoom levels. These maps would only be used in precise applications when zoomed in far or as printed to pdf through MapFish. We should probably limit the zoom level in the SLD, but we’re dealing with some pretty bright people so I’m not worried about misuse. No, the issue is specific to compass roses and just about any projection which is not a normal cylindrical projection.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
Follow

Get every new post delivered to your Inbox.

Join 713 other followers

%d bloggers like this: