目录

上一个主题

1.3. III. GML-地理标记语言

下一个主题

1.5. V. KML-我从 Google 来


1.4. IV. SLD-图层样式描述

1.4.1. 概述

SLD(OpenGIS® Styled Layer Descriptor)当前版本是 1.1.0。SLD 是一

种描述地图图层样式的标准,一般用于 WMS。一个地图不仅包吨数据源组成,还需要对数据进行符号化和渲染,SLD 就是这个定义地图图层符号化和渲染信息的标准。

1.4.2. SLD Schema

和 GML 类似,SLD 也通过一些 XML Schema 来定义 SLD 文档的结构,这

些定义可以通过访问 http://schemas.opengis.net/sld/ 得到。SLD 的 Schema 还依赖其它的 OGC 标准的Schema,其中包括:GML 11 、Filter Encoding 12 、Symbology Encoding 13

1.4.3. SLD 简单例子

下面是一个 SLD 的简单例子,这里对一个多边形图层进行了填充样式的定义:

<?xml version="1.0" encoding="UTF-8"?>

<StyledLayerDescriptor version="1.1.0"

xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"

xmlns="http://www.opengis.net/sld"

xmlns:ogc="http://www.opengis.net/ogc"

xmlns:se="http://www.opengis.net/se"

xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<NamedLayer>

<se:Name>OCEANSEA_1M:Foundationse:Name>

<UserStyle>

<se:Name>GEOSYMse:Name>

<IsDefault>1IsDefault>

<se:FeatureTypeStyle>

<se:FeatureTypeName>Foundationse:FeatureTypeName>

<se:Rule>

<se:Name>mainse:Name>

<se:PolygonSymbolizer

uom="http://www.opengeospatial.org/sld/units/pixel">

<se:Name>MySymbolse:Name>

<se:Description>

<se:Title>Example Symbolse:Title>

<se:Abstract>This is just a simple example.se:Abstract>

se:Description>

<se:Geometry>

<ogc:PropertyName>GEOMETRYogc:PropertyName>

se:Geometry>

<se:Fill>

<se:SvgParameter name="fill">#96C3F5se:SvgParameter>

se:Fill>

se:PolygonSymbolizer>

se:Rule>

se:FeatureTypeStyle>

UserStyle>

NamedLayer>

StyledLayerDescriptor>

其中关键的还是在于 Symbology Encoding(SE)标准定义的符号化和渲染的方式,由于 SE 和 SLD 的依赖关系,因此,在这里也顺便通过几个简单的例子对 SE 进行一下介绉。

1.4.4. SE 示例

在 SE 标准中给出了几个符号化定义的例子,非常的浅显易懂,这几个例子分别定义了点、线、面、文本等内容应该使用什么样的符号化方式显示出来,而在其中出现的 Mark、Stroke、Fill 等元素也很容易理览,下面就从这几个例子大致了览一下 SE 标准的定义。点数据符号化:

<PointSymbolizer version="1.1.0"

xsi:schemaLocation="http://www.opengis.net/se Symbolizer.xsd" xmlns="http://www.opengis.net/se"

xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uom="http://www.opengeospatial.org/se/units/metre">

<Name>MyPointSymbolizerName>

<Description>

<Title>Example PointsymbolizerTitle>

<Abstract>This is just a simple example of a point symbolizer.

Abstract>

Description>

<Graphic>

<Mark>

<WellKnownName>starWellKnownName>

<Fill>

<SvgParameter name="fill">#ff0000SvgParameter>

Fill>

Mark>

<Size>8.0Size>

Graphic>

PointSymbolizer>

线数据符号化:

<LineSymbolizer version="1.1.0"

xsi:schemaLocation="http://www.opengis.net/se Symbolizer.xsd" xmlns="http://www.opengis.net/se"

xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uom="http://www.opengeospatial.org/se/units/metre">

<Name>MyLineSymbolizerName>

<Description>

<Title>Example SymbolTitle>

<Abstract>This is just a simple example of a line symbolizer.

Abstract>

Description>

<Stroke>

<SvgParameter name="stroke">#0000ffSvgParameter>

<SvgParameter name="stroke-width">2SvgParameter>

Stroke>

LineSymbolizer>

面数据符号化:

<PolygonSymbolizer version="1.1.0"

xsi:schemaLocation="http://www.opengis.net/se Symbolizer.xsd" xmlns="http://www.opengis.net/se"

xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uom="http://www.opengeospatial.org/se/units/pixel">

<Name>MyPolygonSymbolizerName>

<Description>

<Title>Example PolygonSymbolizerTitle>

<Abstract>This is just a simple example of a polygon symbolizer.

Abstract>

Description>

<Fill>

<SvgParameter name="fill">#aaaaffSvgParameter>

Fill>

<Stroke>

<SvgParameter name="stroke">#0000aaSvgParameter>

Stroke>

PolygonSymbolizer>

文本标注:

<TextSymbolizer version="1.1.0"

xsi:schemaLocation="http://www.opengis.net/se Symbolizer.xsd" xmlns="http://www.opengis.net/se"

xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uom="http://www.opengeospatial.org/se/units/pixel">

<Name>MyTextSymbolizerName>

<Description>

<Title>Example TextSymbolizerTitle>

<Abstract>This is just an example of a text symbolizer using the

FormatNumber function.Abstract>

Description>

<Geometry>

<ogc:PropertyName>locatedAtogc:PropertyName>

Geometry>

<Label>

<ogc:PropertyName>hospitalNameogc:PropertyName>

Label>

<Font>

<SvgParameter name="font-family">ArialSvgParameter>

<SvgParameter name="font-family">Sans-SerifSvgParameter>

<SvgParameter name="font-style">italicSvgParameter>

<SvgParameter name="font-size">10SvgParameter>

Font>

<Halo />

<Fill>

<SvgParameter name="fill">#000000SvgParameter>

Fill>

TextSymbolizer>
11

http://schemas.opengis.net/gml/

12

http://schemas.opengis.net/filter/

13

http://schemas.opengis.net/se