Introduction to SLD knowledge of map visualization enhancement tool in GeoServer

Table of contents

foreword

 1. Introduction to SLD

1 Introduction

2. Version of SLD

3. Schema description of SLD

2. Analysis of relevant knowledge in SLD

1. Brief description of Scheme

2. An SLD instance

Summarize


foreword

        There are many exquisite maps on the Internet. The maps are vector files such as shp or gdb, which are processed by designers, color matching, labeling, symbolization, etc. The original point-line-surface data becomes colorful and fascinating after being modified by data processors.

        In the common desktop products such as Arcgis or Qgis, it supports the symbolization of map products, and supplements the symbolization with information such as labels to realize the customization of the map style. Usually, in Arcgis, after using ArcMap to set up the map, the mxd file of the map will be generated at the same time. When publishing the map service, you can import the corresponding mxd file into the service to realize the release of the style. So in the free commercial suite GeoServer, how is the style customized?

        This article will briefly introduce the relevant knowledge of the map style customization function in Geoserver. This article will first introduce the basic concepts of SLD and related constraint standards, and then explain a case with an example of SLD to help readers have an intuitive understanding of SLD.

 1. Introduction to SLD

1 Introduction

        Geospatial data (vector and raster) has no intrinsic visual component. In order to view data, it must be styled. Styles specify the color, thickness, and other visible properties used to render data on the map. WMS provides a set of styling options for each dataset; however these options are preconfigured by the server, and users cannot create, inspect, and modify styles.

        Styled Layer Descriptor (SLD) is a standard that enables applications to configure in XML documents how to properly describe layers and legends in WMS. It uses symbol endings (SE) to specify the style of features and coverage. The SLD profile for WMS enhances WMS with additional operations to support the functional style of WFS and the coverage of WCS.

        The role of SLD for maps is similar to that of CSS for HTML. Without CSS, the world of Html will be bleak, and the map without SLD will also lose the unique beauty of the map. SLD is a standard for describing the style of map layers, generally used in WMS. A map not only includes data sources, but also needs to symbolize and render the data. SLD is the standard that defines the symbolization and rendering information of map layers.

2. Version of SLD

        The development of sld to the present is already a version 1.1, developed from the original 1.0. Its implementation standard reference is as follows:

serial number SLD standard reference content
1 1.0.0 OGC Styled Layer Descriptor Implementation Specification, Version 1.0.0
2 1.1.0

OGC Symbology Encoding Implementation Specification, Version 1.1.0

OGC Styled Layer Descriptor profile of the Web Map Service Implementation Specification, Version

        It should be noted that in GeoServer, depending on the version, the degree of support for SLD is different. GeoServer fully implements the SLD1.0.0 standard, but for version 1.1.0, only part of the standard is implemented. Generally speaking, version 1.0.0 has already met the needs of daily life very well.

3. Schema description of SLD

        As a layer style control file in xml format, sld adopts an xml-based definition method. In order to meet its special definition requirements, its xml content has strict schema verification. As long as the service standard supports the standard OGC, the data format of the generated sld should be verified, and the standardized format must also be created when generating the sld.

        Interested friends can see the official definition of sld's schema , and the different historical stages of its Schema.

OpenGIS(r) SLD schema - ReadMe.txt
==================================

OpenGIS Styled Layer Descriptor Profile of the Web Map Service Implementation Specification

More information on the OGC SensorML standard may be found at
 http://www.opengeospatial.org/standards/sld

The most current schema are available at http://schemas.opengis.net/ .

-----------------------------------------------------------------------

2012-07-21  Kevin Stegemoller
  * v1.0 - v1.1: WARNING XLink change is NOT BACKWARD COMPATIBLE.
  * changed OGC XLink (xlink:simpleLink) to W3C XLink (xlink:simpleAttrs)
    per an approved TC and PC motion during the Dec. 2011 Brussels meeting.
    see http://www.opengeospatial.org/blog/1597
  * implement 11-025: retroactively require/add all leaf documents of an
    XML namespace shall explicitly <include/> the all-components schema
  * v1.1.0: added sldAll.xsd as the all-components document (06-135r11 #14)
  * v1.1.0: updated xsd:schema/@version to 1.1.0.2 (06-135r11 s#13.4)
  * v1.0.0: updated xsd:schema/@version to 1.0.0.2 (06-135r11 s#13.4)
  * v1.1: removed 1.1 because it was posted in error. 
    The sld 1.1 URL is rewritten to 1.1.0 to preserve backward compatibility.
  * v0.7.x: schema were removed and archived
  * v1.0.20: schema were removed and archived

2010-11-17  Simon Cox
  * v1.1: Changes to 1.1.0 create SLD 1.1.1
    + added sldAll.xsd as the all-components document (06-135r9 s#14)
    + created sld/1.1 version from SLD 1.1.1

2010-02-01  Kevin Stegemoller
  * v1.1.0, v1.0.20, v1.0.0, v0.7.3, v0.7.2, v0.7.1
    + updated xsd:schema/@version attribute (06-135r7 s#13.4)
    + update relative schema imports to absolute URLs (06-135r7 s#15)
    + update/verify copyright (06-135r7 s#3.2)
    + add archives (.zip) files of previous versions
    + create/update ReadMe.txt (06-135r7 s#17)

2007-11-28  Kevin Stegemoller
  * v1.1.0 Published SLD 1.1.0 schemas from OGC 05-078r4 including
    Corrigendum 1 07-123r1 (Corrigendum 1 for 05-078r4)

2005-11-22  Arliss Whiteside
  * SLD versions 0.7.2 through 1.0.20: The sets of XML Schema Documents
    for OpenGIS Styled Layer Descriptor Versions 0.7.2 through 1.0.20
    have been edited to reflect the corrigenda to all those OGC
    documents that is based on the change requests:
    OGC 05-068r1 "Store xlinks.xsd file at a fixed location"
    OGC 05-081r2 "Change to use relative paths"

  * Note: check each OGC numbered document for detailed changes.

-- [ VERSION NOTES ] --------------------------------------------------

  OGC is incrementally changing how schemas will be hosted. A new
  revision of the Specification Best Practice policy document (06-135r11)
  clarifies this practices.

  OGC is moving to host the schemas using a 2 digit version number so
  that dependent documents (schemas) will not have to change each time a
  schema is corrected (by a corrigendum). The schemas actual version
  number will be kept in the version attribute on the schema element
  which will be used to signify that there has been a change to the
  schema. Each previous revision will be available online in a ZIP
  archive.
  
  The LATEST version is the M.N directory where 
   * M is the major version
   * N is the minor version
  The latest bugfix version now is always in the M.N directory and 
  documented in the version attribute on the schema element. The older
  versions are now archived in the -M_N_X.zip files.
  
  Previously the OGC used M.N.C where
   * M is the major version
   * N is the minor version
   * C is the corrigendum version
  These older M.N.C versions will be updated using M.N.C.X where 
  X may be a bugfix version. These schema will also be .zip archived.

-- 2010-01-21  Kevin Stegemoller  updated 2012-07-21

-----------------------------------------------------------------------

Policies, Procedures, Terms, and Conditions of OGC(r) are available
  http://www.opengeospatial.org/ogc/legal/ .

Copyright (c) 2010 Open Geospatial Consortium.

-----------------------------------------------------------------------

        The above also contains an overview of the upgrade of different versions of SLD from 1.0.0 to 1.1.0.

2. Analysis of relevant knowledge in SLD

1. Brief description of Scheme

         The above figure takes the schema description of version 1.0.0 as an example, and defines some attributes and specific value ranges in the schema requirements. The SLD-specification uses XML to define the map display style, and configures the visual style of map layer rendering by customizing SLD. You can set filters, customize legends, etc. Rule is one of the most important elements of SLD, because it allows classification of data sets according to a given parameter (using a filter). All important parameters related to classification must be set in the rule element.

        For custom styles that use SLD for maps, you must use the standard SE (Symbology Encoding) in combination. SE is another standard of OGC, which is also defined based on the XML schema. This standard allows us to customize different symbol styles to express different elements on the map. SLD files use this language so that the map service can interpret user-defined styles when the map is rendered.

         The above is some analysis of the Schema document. It involves a lot of content, and interested friends can find the official definition on the official website.

2. An SLD instance

Here we share an SLD instance to realize the style control of Point (point element).

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor version="1.0.0" 
 xsi:schemaLocation="http://www.opengis.net/sld 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">
  <!-- a Named Layer is the basic building block of an SLD document -->
  <NamedLayer>
    <Name>default_point</Name>
    <UserStyle>
    <!-- Styles can have names, titles and abstracts -->
      <Title>Red Square Point</Title>
      <Abstract>A sample style that draws a red square point</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering points -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Red Square Point</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
            <PointSymbolizer>
              <Graphic>
                <Mark>
                  <WellKnownName>square</WellKnownName>
                  <Fill>
                    <CssParameter name="fill">#FF0000</CssParameter>
                  </Fill>
                </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

         In the above SLD file, the specific use of PointSymbolizer is demonstrated, and the color fill style is set for point elements. The effect of rendering data using the above style in GeoServer is as follows:

Summarize

        The above is the main content of this article. This article will first introduce the basic concepts of SLD and related constraint standards, and then explain a case with an example of SLD to help readers have an intuitive understanding of SLD. More professional knowledge about SLD can be queried in the corresponding official documents. The writing is hasty. If there is any inappropriateness, welcome to comment and exchange, criticize and correct.

Guess you like

Origin blog.csdn.net/yelangkingwuzuhu/article/details/131276595