Texas roads styled

From OSGeo
Jump to: navigation, search

Data: edges_merge

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 (TIGER 2008 dataset: MTFCC = S1740)
  • local roads (cfcc_2 = 4) are to be depicted with a solid stroke, color #736A59, 1 pixel wide (TIGER 2008 dataset: MTFCC = S1400)
    • label
      • field: FULLNAME
      • max scale: approximately 3,000
      • curve label along feature
      • only label features that are larger than the label
      • font: use /mapserver/etc/Vera.ttf
      • 2 pixel white halo around label text
  • main roads (cfcc_2 = 3) are to be depicted with a piped stroke: (TIGER 2008 dataset: MTFCC = S1200)
    • 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: (TIGER 2008 dataset: MTFCC = S1100)
    • 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 result of this wms request:

 .../wms?HEIGHT=600&WIDTH=950&LAYERS=topp%3Atiger_shp&STYLES=roads_classified&SRS=EPSG%3A4326&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&BBOX=-96.980629943844,29.854114257812,-96.79038641357,29.974268066406

should look like:

Tiger texas classes.png

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>
       <FeatureTypeStyle>
         <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>
       <FeatureTypeStyle>
         <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>
         <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>
         <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>
       <FeatureTypeStyle>
         <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>
       <FeatureTypeStyle>
         <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>