SLD 官方实例
Posted 贝尔格里尔斯
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SLD 官方实例相关的知识,希望对你有一定的参考价值。
1.PointSymbolizer
Example:
<PointSymbolizer> <Graphic> <Mark> <WellKnownName>circle</WellKnownName> <Fill> <CssParameter name="fill">#FF0000</CssParameter> </Fill> </Mark> <Size>6</Size> </Graphic> </PointSymbolizer>
<PointSymbolizer> <Graphic> <ExternalGraphic> <OnlineResource xlink:type="simple" xlink:href="file:///var/www/htdocs/sun.png" /> <Format>image.png</Format> </ExternalGraphic> </Graphic> </PointSymbolizer>
2.LineSymbolizer
Basic Example:
<LineSymbolizer> <Stroke> <CssParameter name="stroke">#0000FF</CssParameter> <CssParameter name="stroke-width">3</CssParameter> <CssParameter name="stroke-dasharray">5 2</CssParameter> </Stroke> </LineSymbolizer>
Offsetting lines:
<LineSymbolizer> <Stroke> <CssParameter name="stroke">#000000</CssParameter> <CssParameter name="stroke-width">2</CssParameter> </Stroke> </LineSymbolizer> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#0000FF</CssParameter> <CssParameter name="stroke-width">3</CssParameter> <CssParameter name="stroke-dasharray">5 2</CssParameter> </Stroke> <PerpendicularOffset>3</PerpendicularOffset> </LineSymbolizer>
Offsetting polygons:
<PolygonSymbolizer> <Stroke> <CssParameter name="stroke">#000000</CssParameter> <CssParameter name="stroke-width">2</CssParameter> </Stroke> </PolygonSymbolizer> <LineSymbolizer> <Stroke> <CssParameter name="stroke">#AAAAAA</CssParameter> <CssParameter name="stroke-width">3</CssParameter> </Stroke> <PerpendicularOffset>-2</PerpendicularOffset> </LineSymbolizer>
3.PolygonSymbolizer
Example:
<PolygonSymbolizer> <Fill> <CssParameter name="fill">#000080</CssParameter> </Fill> </PolygonSymbolizer>
4.TextSymbolizer
Example:
<TextSymbolizer> <Label> <ogc:PropertyName>name</ogc:PropertyName> </Label> <Font> <CssParameter name="font-family">Arial</CssParameter> <CssParameter name="font-size">12</CssParameter> <CssParameter name="font-style">normal</CssParameter> <CssParameter name="font-weight">bold</CssParameter> </Font> <LabelPlacement> <PointPlacement> <AnchorPoint> <AnchorPointX>0.5</AnchorPointX> <AnchorPointY>0.0</AnchorPointY> </AnchorPoint> <Displacement> <DisplacementX>0</DisplacementX> <DisplacementY>25</DisplacementY> </Displacement> <Rotation>-45</Rotation> </PointPlacement> </LabelPlacement> <Fill> <CssParameter name="fill">#990099</CssParameter> </Fill> </TextSymbolizer>
Scalable Font Size:
<CssParameter name="font-size"> <ogc:Function name="Categorize"> <!-- Value to transform --> <ogc:Function name="env"> <ogc:Literal>wms_scale_denominator</ogc:Literal> </ogc:Function> <!-- Output values and thresholds --> <!-- Ranges: --> <!-- [scale <= 300, font 12] --> <!-- [scale 300 - 2500, font 10] --> <!-- [scale > 2500, font 8] --> <ogc:Literal>12</ogc:Literal> <ogc:Literal>300</ogc:Literal> <ogc:Literal>10</ogc:Literal> <ogc:Literal>2500</ogc:Literal> <ogc:Literal>8</ogc:Literal> </ogc:Function> </CssParameter>
以上是关于SLD 官方实例的主要内容,如果未能解决你的问题,请参考以下文章
利用 uDig 生成 GeoServer 可用的 SLD 渲染文件