Difference between revisions of "Texas roads styled"

From OSGeo
Jump to navigation Jump to search
Line 13: Line 13:
 
on the bottom of everything else.
 
on the bottom of everything else.
 
Also, the piped lines should draw properly at line junctions (the inner line must not be interrupted)
 
Also, the piped lines should draw properly at line junctions (the inner line must not be interrupted)
 +
 +
 +
 +
The SLD definition of the layers follows:
 +
 +
<nowiki>
 +
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<StyledLayerDescriptor version="1.0.0"
 +
  xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/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>Texas roads, styled</Name>
 +
    <UserStyle>
 +
      <!--  First level, draws minor roads before everything else -->
 +
      <FeatureTypeStyle>
 +
        <!-- Minor roads -->
 +
        <Rule>
 +
          <ogc:Filter>
 +
            <ogc:PropertyIsGreaterThan>
 +
              <ogc:PropertyName>CFCC_2</ogc:PropertyName>
 +
              <ogc:Literal>4</ogc:Literal>
 +
            </ogc:PropertyIsGreaterThan>
 +
          </ogc:Filter>
 +
          <LineSymbolizer>
 +
            <Stroke>
 +
              <CssParameter name="stroke">#AAAAAA</CssParameter>
 +
              <CssParameter name="stroke-width">1</CssParameter>
 +
              <CssParameter name="stroke-dasharray">5 5</CssParameter>
 +
            </Stroke>
 +
          </LineSymbolizer>
 +
        </Rule>
 +
      </FeatureTypeStyle>
 +
 +
      <!--  Second level, draws the local, main and highway roads (they are all the same color) -->
 +
      <FeatureTypeStyle>
 +
 +
        <!-- Local roads -->
 +
        <Rule>
 +
          <ogc:Filter>
 +
            <ogc:PropertyIsEqualTo>
 +
              <ogc:PropertyName>CFCC_2</ogc:PropertyName>
 +
              <ogc:Literal>4</ogc:Literal>
 +
            </ogc:PropertyIsEqualTo>
 +
          </ogc:Filter>
 +
          <LineSymbolizer>
 +
            <Stroke>
 +
              <CssParameter name="stroke">#736A59</CssParameter>
 +
              <CssParameter name="stroke-width">1</CssParameter>
 +
            </Stroke>
 +
          </LineSymbolizer>
 +
        </Rule>
 +
 +
        <!-- Main roads, outer line -->
 +
        <Rule>
 +
          <ogc:Filter>
 +
            <ogc:PropertyIsEqualTo>
 +
              <ogc:PropertyName>CFCC_2</ogc:PropertyName>
 +
              <ogc:Literal>3</ogc:Literal>
 +
            </ogc:PropertyIsEqualTo>
 +
          </ogc:Filter>
 +
          <LineSymbolizer>
 +
            <Stroke>
 +
              <CssParameter name="stroke">#736A59</CssParameter>
 +
              <CssParameter name="stroke-width">4</CssParameter>
 +
              <CssParameter name="stroke-linecap">round</CssParameter>
 +
              <CssParameter name="stroke-join">round</CssParameter>
 +
            </Stroke>
 +
          </LineSymbolizer>
 +
        </Rule>
 +
 +
        <!--  Highways, outer line -->
 +
        <Rule>
 +
          <ogc:Filter>
 +
            <ogc:PropertyIsLessThan>
 +
              <ogc:PropertyName>CFCC_2</ogc:PropertyName>
 +
              <ogc:Literal>3</ogc:Literal>
 +
            </ogc:PropertyIsLessThan>
 +
          </ogc:Filter>
 +
          <LineSymbolizer>
 +
            <Stroke>
 +
              <CssParameter name="stroke">#736A59</CssParameter>
 +
              <CssParameter name="stroke-width">8</CssParameter>
 +
              <CssParameter name="stroke-linecap">round</CssParameter>
 +
              <CssParameter name="stroke-join">round</CssParameter>
 +
            </Stroke>
 +
          </LineSymbolizer>
 +
        </Rule>
 +
      </FeatureTypeStyle>
 +
 +
      <!--  Third level, draws the main road inner line so that it always stay behind of the highway one -->
 +
      <FeatureTypeStyle>
 +
        <!-- Main roads, inner line -->
 +
        <Rule>
 +
          <ogc:Filter>
 +
            <ogc:PropertyIsEqualTo>
 +
              <ogc:PropertyName>CFCC_2</ogc:PropertyName>
 +
              <ogc:Literal>3</ogc:Literal>
 +
            </ogc:PropertyIsEqualTo>
 +
          </ogc:Filter>
 +
          <LineSymbolizer>
 +
            <Stroke>
 +
              <CssParameter name="stroke">#F4E000</CssParameter>
 +
              <CssParameter name="stroke-width">2</CssParameter>
 +
              <CssParameter name="stroke-linecap">round</CssParameter>
 +
              <CssParameter name="stroke-join">round</CssParameter>
 +
            </Stroke>
 +
          </LineSymbolizer>
 +
        </Rule>
 +
      </FeatureTypeStyle>
 +
 +
      <!--  Fourth level, draws the highway inner line on top of everything -->
 +
      <FeatureTypeStyle>
 +
        <!-- Highways, inner line -->
 +
        <Rule>
 +
          <ogc:Filter>
 +
            <ogc:PropertyIsLessThan>
 +
              <ogc:PropertyName>CFCC_2</ogc:PropertyName>
 +
              <ogc:Literal>3</ogc:Literal>
 +
            </ogc:PropertyIsLessThan>
 +
          </ogc:Filter>
 +
          <LineSymbolizer>
 +
            <Stroke>
 +
              <CssParameter name="stroke">#F3A200</CssParameter>
 +
              <CssParameter name="stroke-width">6</CssParameter>
 +
              <CssParameter name="stroke-linecap">round</CssParameter>
 +
              <CssParameter name="stroke-join">round</CssParameter>
 +
            </Stroke>
 +
          </LineSymbolizer>
 +
        </Rule>
 +
      </FeatureTypeStyle>
 +
    </UserStyle>
 +
  </NamedLayer>
 +
</StyledLayerDescriptor>
 +
 +
 +
</nowiki>

Revision as of 06:21, 17 August 2009

Texas roads, styled The style is based on the following rules:

  • minor roads (cfcc_2 > 4) are to be depicted with a dashed stroke (5 pixels line, 5 pixels space), light gray color (#AAAAAA), 1 pixel wide
  • local roads (cfcc_2 = 4) are to be depicted with a solid stroke, color #736A59, 1 pixel wide
  • main roads (cfcc_2 = 3) are to be depicted with a piped stroke:
    • outer line is 4 pixel wide, #736A59 color, round line caps and joins
    • inner line is 2 pixel wide, #F4E000 color, round line caps and joins
  • highways (cfcc_2 < 3) are to be depicted with a piped stroke as well:
    • outer line is 8 pixel wide, #736A59 color, round line caps and joins
    • inner line is 6 pixel wide, #F3A200 color, round line caps and joins

Rendering must be done so that, visually, highways stay on top of everything, major roads on top of the rest, and minor roads on the bottom of everything else. Also, the piped lines should draw properly at line junctions (the inner line must not be interrupted)


The SLD definition of the layers follows:

<?xml version="1.0" encoding="UTF-8"?> <StyledLayerDescriptor version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/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>Texas roads, styled</Name> <UserStyle> <!-- First level, draws minor roads before everything else --> <FeatureTypeStyle> <!-- Minor roads --> <Rule> <ogc:Filter> <ogc:PropertyIsGreaterThan> <ogc:PropertyName>CFCC_2</ogc:PropertyName> <ogc:Literal>4</ogc:Literal> </ogc:PropertyIsGreaterThan> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#AAAAAA</CssParameter> <CssParameter name="stroke-width">1</CssParameter> <CssParameter name="stroke-dasharray">5 5</CssParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <!-- Second level, draws the local, main and highway roads (they are all the same color) --> <FeatureTypeStyle> <!-- Local roads --> <Rule> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>CFCC_2</ogc:PropertyName> <ogc:Literal>4</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#736A59</CssParameter> <CssParameter name="stroke-width">1</CssParameter> </Stroke> </LineSymbolizer> </Rule> <!-- Main roads, outer line --> <Rule> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>CFCC_2</ogc:PropertyName> <ogc:Literal>3</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#736A59</CssParameter> <CssParameter name="stroke-width">4</CssParameter> <CssParameter name="stroke-linecap">round</CssParameter> <CssParameter name="stroke-join">round</CssParameter> </Stroke> </LineSymbolizer> </Rule> <!-- Highways, outer line --> <Rule> <ogc:Filter> <ogc:PropertyIsLessThan> <ogc:PropertyName>CFCC_2</ogc:PropertyName> <ogc:Literal>3</ogc:Literal> </ogc:PropertyIsLessThan> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#736A59</CssParameter> <CssParameter name="stroke-width">8</CssParameter> <CssParameter name="stroke-linecap">round</CssParameter> <CssParameter name="stroke-join">round</CssParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <!-- Third level, draws the main road inner line so that it always stay behind of the highway one --> <FeatureTypeStyle> <!-- Main roads, inner line --> <Rule> <ogc:Filter> <ogc:PropertyIsEqualTo> <ogc:PropertyName>CFCC_2</ogc:PropertyName> <ogc:Literal>3</ogc:Literal> </ogc:PropertyIsEqualTo> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#F4E000</CssParameter> <CssParameter name="stroke-width">2</CssParameter> <CssParameter name="stroke-linecap">round</CssParameter> <CssParameter name="stroke-join">round</CssParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> <!-- Fourth level, draws the highway inner line on top of everything --> <FeatureTypeStyle> <!-- Highways, inner line --> <Rule> <ogc:Filter> <ogc:PropertyIsLessThan> <ogc:PropertyName>CFCC_2</ogc:PropertyName> <ogc:Literal>3</ogc:Literal> </ogc:PropertyIsLessThan> </ogc:Filter> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#F3A200</CssParameter> <CssParameter name="stroke-width">6</CssParameter> <CssParameter name="stroke-linecap">round</CssParameter> <CssParameter name="stroke-join">round</CssParameter> </Stroke> </LineSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor>