GeoServer style 配置样例

<?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_line</Name>
		<UserStyle>
			<!-- Styles can have names, titles and abstracts -->
			<Title>Default Line</Title>
			<Abstract>A sample style that draws a line</Abstract>
			<!-- FeatureTypeStyles describe how to render different features -->
			<!-- A FeatureTypeStyle for rendering lines -->
			<FeatureTypeStyle>
				<Rule>
				   <ogc:Filter>
                                                <!-- 字段等于7的规则-->
						<ogc:PropertyIsEqualTo>
							<ogc:PropertyName>SUBTYPE</ogc:PropertyName>
							<ogc:Literal>7</ogc:Literal>
						</ogc:PropertyIsEqualTo>
					</ogc:Filter>
			                <!-- 线条展示-->
					<PolygonSymbolizer>
						<Stroke>
							<CssParameter name="stroke">#FF8C00</CssParameter>
							<CssParameter name="stroke-width">2</CssParameter>
						</Stroke>
					</PolygonSymbolizer>
                                          <!-- 文字展示-->
					<TextSymbolizer>
						<Label>
							<ogc:PropertyName>NAME</ogc:PropertyName>
						</Label>
						<Fill>
							<CssParameter name="fill">#FF8C00</CssParameter>
						</Fill>
						<Font>
							<CssParameter name="font-style">Normal</CssParameter>
							<CssParameter name="font-size">14</CssParameter>
							<CssParameter name="font-weight">bold</CssParameter>
						</Font>
					</TextSymbolizer>
				</Rule>
							<Rule>
				   <ogc:Filter>
						<ogc:PropertyIsEqualTo>
							<ogc:PropertyName>SUBTYPE</ogc:PropertyName>
							<ogc:Literal>8</ogc:Literal>
						</ogc:PropertyIsEqualTo>
					</ogc:Filter>
			
					<PolygonSymbolizer>
						<Stroke>
							<CssParameter name="stroke">#2F695E</CssParameter>
							<CssParameter name="stroke-width">2</CssParameter>
						</Stroke>
					</PolygonSymbolizer>
					<TextSymbolizer>
						<Label>
							<ogc:PropertyName>NAME</ogc:PropertyName>
						</Label>
						<Fill>
							<CssParameter name="fill">#2F695E</CssParameter>
						</Fill>
						<Font>
							<CssParameter name="font-style">Normal</CssParameter>
							<CssParameter name="font-size">14</CssParameter>
							<CssParameter name="font-weight">bold</CssParameter>
						</Font>
					</TextSymbolizer>
				</Rule>
			</FeatureTypeStyle>
		</UserStyle>
	</NamedLayer>
</StyledLayerDescriptor>
  • 效果展示

posted @ 2021-11-19 10:44  微笑带你去  阅读(215)  评论(0编辑  收藏  举报