# Presentation: 806381

## The National Map Catalog

**Consistent Symbology for **
***The National Map***** **
**The Introduction of **
**Styled Layer Descriptors (SLD)**

**Notes:**
Introduce this session by saying that we are going to talk about Consistent Symbology with 
Styled Layer Descriptors (SLD)

## A scientific document and 

- A scientific document and
- a fine, hand-crafted work of art.

- Still extremely useful, but
- a static and often dated
- document.

- Other federal, state, local, and
- commercial organizations are
- producing high quality data.

**Notes:**
The most widely known form of geographic base information for the United States is the USGS primary series topographic map. The USGS has produced more than 55,000 unique map sheets and approximately 220,000 digital orthorectified aerial images to cover the Nation. These maps and images are a national treasure, but the average primary series topographic map is 23 years old.

## The National Map

- Marcel Duchamp
*Bicycle Wheel*
- 1915

*The National Map*
- is made up of
- “readymades”.
- Data created to meet
- the needs of a variety
- of data producers.
- Different uses, needs,
- attribution, classification,
- and symbology.

**Notes:**
Bicycle Wheel and other readymades
Bicycle Wheel was the first of a class of objects that Duchamp called his “readymades”.  He created twenty-one of them, all between 1915 and 1923.  The readymades are a varied collection of items, but there are several ideas that unite them.  TNM is a collection of readymades and one can think of the catalog as the “idea” uniting them.

## The Problem

**Distributed map services can present data sets with varied symbology strategies.**

**Notes:**
This graphic shows the provider symbology for the Kansas, Missouri, Oklahoma, and Arkansas map servers. Notice not only the symbol differences but that scale dependency is handled uniquely by each service.  Arkansas represents the most extreme case with no scale or symbol constraints – all features represented in the requested Arkansas roads layer are displayed with a single black symbol.

## “fine-grained control of the graphical representation of data is a 

- fundamental requirement of any professional mapping community”
- 	Styled Layer Implementation Specification, Open GIS Consortium Inc, 2002-09-19, pp ix

## The Solution

**The OGC SLD Specification provides a means of overriding the default symbology.**

**Notes:**
This graphic shows the results of requesting the same map service images using SLDs to override the provider symbology - producing a consistent symbol and scale presentation from each of these distinct services.

## SLD Overview

**The OGC Styled Layer Descriptor (SLD) is an optional feature of an OGC-WMS 1.1.0. and 1.1.1**
**SLDs are specified as part of the getMap WMS request to allow Catalog-defined symbology to override the provider’s symbology.**
**SLDs define the symbol(s) to be used.**
**SLDs may break a WMS layer into layer parts by:**
**FeatureType (point, line, and polygon)**
**Scale Dependencies **
**Layer data attributes**

**Notes:**
SLD Overview
The OGC Styled Layer Descriptor (SLD) is an optional feature of an OGC-WMS 1.1.0. and 1.1.1
SLDs are specified as part of the getMap WMS request to allow Catalog-defined symbology to override the provider’s symbology.
SLDs define the symbol(s) to be used.
SLDs may break a WMS layer into layer parts by:
FeatureType (point, line, and polygon)
Scale Dependencies 
Layer data attributes

## A Basic SLD Example

- <?xml version="1.0" encoding="UTF-8" ?> -
- <sld:StyledLayerDescriptor>-
- <sld:NamedLayer>
-   <sld:Name>County Boundary</sld:Name>
-     <sld:UserStyle>
-       <sld:FeatureTypeStyle>
-         <sld:Rule>
-           <sld:LineSymbolizer>
-             <sld:Stroke>
-               <sld:CssParameter name="stroke">#000000</sld:CssParameter>
-               <sld:CssParameter name="stroke-opacity">0.25</sld:CssParameter>
-               <sld:CssParameter name="stroke-width">1.0</sld:CssParameter>
-             </sld:Stroke>
-           </sld:LineSymbolizer>
-         </sld:Rule>
-       </sld:FeatureTypeStyle>
-     </sld:UserStyle>
-   </sld:NamedLayer>
- </sld:StyledLayerDescriptor>

- Black
- 25% Opaque
- 1 Pixel Wide

- Layer Name

**Notes:**
This simple SLD defines a single ‘LineSymbol’ to be used for all lines data displayed in the County Boundary layer.

## A Scale-Dependent SLD

- <?xml version="1.0" encoding="UTF-8" ?> -
- <sld:StyledLayerDescriptor>-
- <sld:NamedLayer>
-   <sld:Name>County Boundary</sld:Name>
-     <sld:UserStyle>
-       <sld:FeatureTypeStyle>
-         <sld:Rule>
**          ****<****MinScaleDenominator****>****1200****</****MinScaleDenominator****>**
** **** ****        ****<****MaxScaleDenominator****>****100001****</****MaxScaleDenominator****>**** **
-           <sld:LineSymbolizer>
-             <sld:Stroke>
-               <sld:CssParameter name="stroke">#000000</sld:CssParameter>
-               <sld:CssParameter name="stroke-opacity">0.25</sld:CssParameter>
-               <sld:CssParameter name="stroke-width">1.0</sld:CssParameter>
-             </sld:Stroke>
-           </sld:LineSymbolizer>
-         </sld:Rule>
-       </sld:FeatureTypeStyle>
-     </sld:UserStyle>
-   </sld:NamedLayer>
- </sld:StyledLayerDescriptor>

- You Can Define the
- Scale Range

**Notes:**
In this example scale dependency has been added to the SLD ‘Rule’ so that the specified symbol is only used when the scale of the map image is within the specified range of values indicated by MinScaleDenominator and MaxScaleDenominator.

## A Layer-Part SLD

- <?xml version="1.0" encoding="UTF-8" ?> -
- <sld:StyledLayerDescriptor>-
- <sld:NamedLayer>
-   <sld:Name>Roads</sld:Name>
-     <sld:UserStyle>
-       <sld:FeatureTypeStyle>
-         <sld:Rule>
**          ****<****ogc:Filter****>**
**            ****<****ogc:PropertyIsEqualTo****>**
**              ****<****ogc:PropertyName****>****Level_****</****ogc:PropertyName****>**
**              ****<****ogc:Literal****>****45****</****ogc:Literal****>**
**            ****</****ogc:PropertyIsEqualTo****>**** **** **
**          ****</****ogc:Filter****>**
-           <sld:LineSymbolizer>
-             <sld:Stroke>
-               <sld:CssParameter name="stroke">#000000</sld:CssParameter>
-               <sld:CssParameter name="stroke-opacity">0.25</sld:CssParameter>
-               <sld:CssParameter name="stroke-width">1.0</sld:CssParameter>
-             </sld:Stroke>
-           </sld:LineSymbolizer>...
- </sld:StyledLayerDescriptor>

- Attribute Field

- Attribute Value

**Notes:**
In this example the layer is filtered based on attributes so that the specified symbol only is applied when the layer data contains an attribute field called ‘Level_’ and a value (Literal) of ’45’. 

## The National MapCatalog Implementation

**Notes:**
This section we will talk about we implement SLDs in the catalog

## Static SLD

**A static SLD URL may be specified for each data layer in the Catalog.**
**The URL may reside on USGS or data partner web servers.**
**Static SLD takes advantage of the ability to override default map server symbology rules.**
**Static SLD has disadvantages:**
**Symbol definitions are not normalized in a single place requiring symbol changes to be made in multiple locations.**
**Scale-dependencies and Layer-part filters are hard-coded in each SLD document and not easily maintained or available to other applications.**
**Legend graphics must be refreshed every time the SLD changes.**

**Notes:**
Static SLD
A static SLD URL may be specified for each data layer in the Catalog.
The URL may reside on USGS or data partner web servers.
Static SLD takes advantage of the ability to override default map server symbology rules.
Static SLD has disadvantages:
Symbol definitions are not normalized in a single place requiring symbol changes to be made in multiple locations.
Scale-dependencies and Layer-part filters are hard-coded in each SLD document and not easily maintained or available to other applications.
Legend graphics must be refreshed every time the SLD changes.

## Dynamic SLD

**Because of the disadvantages of static SLDs, the Catalog has implemented new services to support Dynamic SLD and subsequent Legend generation**
**Dynamic SLDs offer the following advantages over static SLDs****:**
**SLD symbol definitions are normalized in a single location within the Catalog simplifying maintenance and sharing issues.**
**Scale-dependent, and layer-part filters are consistently defined within the Catalog at the layer or layer-part level.**
**Legends are dynamically created from information stored in the Catalog to reflect each symbol change.**

**Notes:**
Dynamic SLD
Because of the disadvantages of static SLDs, the Catalog has implemented new services to support Dynamic SLD and subsequent Legend generation

Dynamic SLD offers the following advantages:
SLD symbol definitions are normalized in a single location within the Catalog simplifying maintenance and sharing issues.
Scale-dependent, and layer-part filters are consistently defined within the Catalog at the layer or layer-part level.
Legends are dynamically created from information stored in the Catalog to reflect each symbol change.
Layer-part control of presentation.  (Example: only show Interstate and US highways.)

## Dynamic SLD Components

**Catalog**

**Layer**

**Dynamic SLD Components**

**Symbols**

**Legend**

**SLD Symbols**

**Layer-Parts**

**Dynamic Legend**

**Dynamic SLD**

- OGC
- Style
- Management
- Service

**Notes:**
The Catalog database stores the symbol definitions, and layer-part mappings.  Applications can take the Layer and Symbol definitions and create an SLD document dynamically; and from this generate the SLD and corresponding Legend graphic.  

## Mid- Continent Mapping Center has created SLDGenerator.

**SLDGenerator writes the XML document directly from **
**entries in the Catalog.**

**Mid-Continent Mapping Center has also created LegendCreator.**
**LegendCreator takes the symbols created by the SLD and **
**creates a legend.**

## Layer Parts

- Parent Layer

**Notes:**
Location of Parent Layer and Layer Parts or child layers in the catalog.

## Parent Elementid

- Defined Symbol

- Part Filter

**Notes:**
Location of Parent Elementid, Part Filter and Defined Symbol.  These are all parts needed to create Dynamic SLD’s.

## Interstates

**Interstates**

**U S Hwys**

**State Rts**

**Notes:**
Examples of road symbolization using SLDs.

## Implementation Issues

- Connector “Flavors”
- CAST ArcIMS Connector
- ESRI ArcIMS Connectors  one is secure, one’s not
- WRG ArcIMS Connector
- MCMC ArcIMS Connector
- MN Map Server Connector .........Each works differently
- Symbology
- Dashes and Dots.......symbols designed for fixed scales
- Attribution
- Don’t need a single common attribute
- But need something distinguishing...some don’t have

## The National Map Catalog

- usgscatalog@usgs.gov

- John Murphey
- jmurphey@usgs.gov
- 573-308-3579

**Notes:**
End of presentation