Providing geoscience data globally Navigation
Main content
Bottom links

OneGeology

Home > How to serve a OneGeology WMS > Deployment > Styling

7.4.5 Styling (SLDs)

Part of the process of deploying a web map service includes defining the map legend or portrayal. The use of GeoSciML-Portrayal and standardized vocabularies for representative lithology and age enables legends to be applied uniformly using OGC Styled Layer Descriptor (Lupp, 2007) (SLD) files that can be shared on the World Wide Web. An SLD is an XML document that defines a collection of rules using feature property values to select features assigned a particular graphical element for map display. The selection criteria use OGC Filter (Vretanos, 2010) encoding for logic, and XPaths relative to the feature type XML schema to specify the properties used in the selection. The collection of rules used to portray feature constitutes a map legend.

Services deployed using ESRI ArcGIS Server can use the legend associated with a layer in the ArcMap project file from which the service is deployed. If you are using GeoServer to deploy the web map service, an OGC Styled Layer Descriptor (SLD) file is used to define the map legend. SLD files can also be used to define the symbolization scheme for services deployed with ArcGIS server. OGC WMS 1.3.0 services allow a web accessible SLD file to be specified in a GetMap request, enabling users to define custom symbolization schemes for maps returned by the service.

SLD files are available for standardized portrayal schemes using either the CGI or INSPIRE simple lithology:

and the CGI/INSPIRE 2012 time scale:

These files define a standardized portrayal scheme for symbolizing geologic unit outcrop polygons, and recommended practice is to provide WMS layers using these portrayal schemes for any OneGeology GeoSciML-Portrayal service.

Some other test SLD’s are also posted at http://schemas.usgin.org/schemas/slds/.

One suggested methodology to enable user-defined, custom symbolization by specifying a web-accessible SLD file in a WMS GetMap request, is that OneGeology-Portrayal services should also include WMS layers with names corresponding to the GeoSciML-Portrayal feature type exposed by that layer (though layer titles must still follow the OneGeology WMS profile naming conventions). With this methodology the recommended layer names are prefixed with ‘gsmlp’ and the schema version. Thus services based on GeoSciML-Portrayal version 2.0 would have layers named:

  • gsmlp2.0:geologicunitview
  • gsmlp2.0:sheardisplacementstructureview
  • gsmlp2.0:contactview

Similarly (using this suggested methodology), services based on GeoSciML-Portrayal version 4.0 would have layers named:

  • gsmlp4.0:geologicunitview
  • gsmlp4.0:sheardisplacementstructureview
  • gsmlp4.0:contactview

The actual names of the layers though are not important to the OneGeology thematic tool which creates custom SLD stylesheets on demand using the names of the layers registered in the portal. Services configured using the previous GeoSciML-Portrayal 2.0 schema will continue to work in the portal, because the two schemas share the same property names and demand concepts from the same controlled vocabularies; moreover GeoSciML-Portrayal version 4.0 is less restrictive than version 2.0 (has fewer mandatory properties), so anything that conformed to the former will conform to the latter version.

SLD’s intended to be used with OneGeology GeoSciML-Portrayal services would specify an sld:NamedLayer with of these values (depending on the feature type offered by the layer). If an sld:UserStyle is specified in the SLD, then the style name must be specified in the WMS GetMap request; otherwise the STYLE parameter in the request is empty.

It is possible to manually create an SLD using a text editor or one of the standard XML editor tools, but instructions for creating an SLD file manually are out of the scope of this document. The GeoServer online documentation provides some guidance for creating SLD’s manually. Appendix J: How to create a Styled Layer Descriptor (SLD) using Arc2Earth describes software for creating an SLD file based on symbology in an ArcMap project layer.

Code example 2 is a snippet of an SLD file that assigns colors to gsmlp2.0:geologicunitview layer polygons with representativeAge URIs for Holocene and Quaternary.

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <StyledLayerDescriptor
        xmlns:gml="http://www.opengis.net/gml" 
        xmlns:gsmlp="http://geosciml.org/xmlns/GeoSciML-Portrayal/2.0" 
        xmlns:ogc="http://www.opengis.net/ogc" 
        xmlns:sld="http://www.opengis.net/sld" 
        xmlns:xlink="http://www.w3.org/1999/xlink"
        version="1.0.0">	
        <NamedLayer>
          <Name>gsmlp2.0:geologicunitview</Name>
          <UserStyle>
            <FeatureTypeStyle>
              <Rule>
                <Name>Holocene</Name>
                <Title>Holocene</Title>
                <ogc:Filter>
                  <ogc:PropertyIsEqualTo>
                    <ogc:PropertyName>representativeAge_uri</ogc:PropertyName>
                    <ogc:Literal>
                      <http://resource.geosciml.org/classifier/ics/ischart/Holocene>
                    </ogc:Literal>
                  </ogc:PropertyIsEqualTo>
                </ogc:Filter>
                <PolygonSymbolizer>
                  <Fill>
                    <CssParameter name=’fill’>#9FFF02</CssParameter>
                  </Fill>
                </PolygonSymbolizer>
              </Rule>
              <Rule>
                <Name>Quaternary</Name>
                <Title>Quaternary</Title>
                <ogc:Filter>
                  <ogc:PropertyIsEqualTo>
                    <ogc:PropertyName>representativeAge_uri</ogc:PropertyName>
                    <ogc:Literal>
                      <http://resource.geosciml.org/classifier/ics/ischart/Quaternary>
                    </ogc:Literal>
                  </ogc:PropertyIsEqualTo>
                </ogc:Filter>
                <PolygonSymbolizer>
                  <Fill>
                    <CssParameter name=’fill’>#FF9F22</CssParameter>
                  </Fill>
                </PolygonSymbolizer>
              </Rule>
            </FeatureTypeStyle>
          </UserStyle>
        </NamedLayer>
      </StyledLayerDescriptor> 
      

Code example 2. Fragment of a Styled Layer Descriptor XML file with SLD rules for age portrayal of Holocene or Quaternary geologicUnitView polygons.

Note that the LAYERS parameter value in the request must match the (XPath) NamedLayer/Name element value in the SLD file, and this must also match one of the layer names in the capabilities for the WMS service.

      <?xml version="1.0" encoding="ISO-8859-1"?>
      <StyledLayerDescriptor 
        xmlns:gml="http://www.opengis.net/gml" 
        xmlns:gsmlp="http://geosciml.org/xmlns/GeoSciML-Portrayal/2.0" 
        xmlns:ogc="http://www.opengis.net/ogc" 
        xmlns="http://www.opengis.net/sld" 
        xmlns:xlink="http://www.w3.org/1999/xlink" 
        version="1.0.0">
        <NamedLayer>
          <Name>gsmlp2.0:geologicunitview</Name>
            <UserStyle>
              <FeatureTypeStyle>
              <Rule>
                <Name>sediment</Name>
                <Abstract>(description of unit)</Abstract>
                <ogc:Filter>
                  <ogc:Or>
                    <ogc:PropertyIsEqualTo>
                      <ogc:PropertyName>representativeLithology_uri</ogc:PropertyName>
                      <ogc:Literal>
                        http://resource.geosciml.org/classifier/cgi/lithology/0232
                      </ogc:Literal>
                    </ogc:PropertyIsEqualTo>
                    <ogc:PropertyIsEqualTo>
                      <ogc:PropertyName>representativeLithology_uri</ogc:PropertyName>
                      <ogc:Literal>
                        http://resource.geosciml.org/classifier/cgi/lithology/sediment
                      </ogc:Literal>
                    </ogc:PropertyIsEqualTo>
                  </ogc:Or>
                </ogc:Filter>
                <PolygonSymbolizer>
                  <Fill>
                    <CssParameter name="fill">#FFFF00</CssParameter>
                  </Fill>
                </PolygonSymbolizer>
              </Rule>	
            </FeatureTypeStyle>
          </UserStyle>
        </NamedLayer>
      </StyledLayerDescriptor>
      

Note that the LAYERS parameter value in the request must match the (XPath) NamedLayer/Name element value in the SLD file, and this must also match one of the layer names in the capabilities for the WMS service.

Section last modified: 9 May 2016

Back|Next