基于geoserver的sld符号几个样式


基于geoserver的sld符号几个样式
1.有边线的透明面sld符号

<?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>ploygon_line</Name>
    <UserStyle>
    <!-- Styles can have names, titles and abstracts -->
      <Title>ploygon_line</Title>
      <Abstract>A sample style that draws a polygon</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering polygons -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Gray Polygon with Black Outline</Title>
          <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#AAAAAA</CssParameter>
              <CssParameter name="fill-opacity">0</CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">0.1</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

普通面sld符号

<?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_polygon</Name>
    <UserStyle>
    <!-- Styles can have names, titles and abstracts -->
      <Title>Default Polygon</Title>
      <Abstract>A sample style that draws a polygon</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering polygons -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Gray Polygon with Black Outline</Title>
          <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#AAAAAA</CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">#000000</CssParameter>
              <CssParameter name="stroke-width">0.1</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

2 普通点sld符号

<?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>Default Point</Title>
      <Abstract>A sample style that draws a point</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering points -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Red Square</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>

3 普通线sld符号

<?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>
          <Name>rule1</Name>
          <Title>Blue Line</Title>
          <Abstract>A solid blue line with a 1 pixel width</Abstract>
          <LineSymbolizer>
            <Stroke>
              <CssParameter name="stroke">#0000FF</CssParameter>
            </Stroke>
          </LineSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>
  1. 伪三维2.5D的sld符号
<?xml version="1.0" encoding="ISO-8859-1"?>  
<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_polygon</Name>  
        <UserStyle>  
            <!-- Styles can have names, titles and abstracts -->  
            <Title>Default Polygon</Title>  
            <Abstract>A sample style that draws a polygon</Abstract>  
            <!-- FeatureTypeStyles describe how to render different features -->  
            <!-- A FeatureTypeStyle for rendering polygons -->  
            <FeatureTypeStyle>  
                <Rule>  
                    <PolygonSymbolizer>  
                        <Geometry>  
                            <ogc:Function name="isometric">  
                                <ogc:PropertyName>the_geom</ogc:PropertyName>  
                                <ogc:Literal>0.00001</ogc:Literal>  
                            </ogc:Function>  
                        </Geometry>  
                        <Fill>  
                            <CssParameter name="fill">#dddddd</CssParameter>  
                        </Fill>  
                        <Stroke>  
                            <CssParameter name="stroke">#999999</CssParameter>  
                            <CssParameter name="stroke-width">0.1</CssParameter>  
                        </Stroke>  
                    </PolygonSymbolizer>  
                </Rule>  
            </FeatureTypeStyle>  
            <FeatureTypeStyle>  
                <Rule>  
                    <PolygonSymbolizer>  
                        <Geometry>  
                            <ogc:Function name="offset">  
                                <ogc:PropertyName>the_geom</ogc:PropertyName>  
                                <ogc:Literal>0</ogc:Literal>  
                                <ogc:Literal>0.00001</ogc:Literal>  
                            </ogc:Function>  
                        </Geometry>  
                        <Fill>  
                            <CssParameter name="fill">#ffffe0</CssParameter>  
                        </Fill>  
                        <Stroke>  
                            <CssParameter name="stroke">#999999</CssParameter>  
                            <CssParameter name="stroke-width">0.1</CssParameter>  
                        </Stroke>  
                    </PolygonSymbolizer>  
                </Rule>  
            </FeatureTypeStyle>  
        </UserStyle>  
    </NamedLayer>  
</StyledLayerDescriptor>

5.伪三维2.5D带比例尺缩放显示的sld符号

<?xml version="1.0" encoding="UTF-8"?>
<sld:StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:sld="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" version="1.0.0">
    <sld:UserLayer>
        <sld:LayerFeatureConstraints>
            <sld:FeatureTypeConstraint/>
        </sld:LayerFeatureConstraints>
        <sld:UserStyle>
            <sld:Name>hikvision2qi b3 tingchewei</sld:Name>
            <sld:FeatureTypeStyle>
                <sld:Name>group 0</sld:Name>
                <sld:FeatureTypeName>Feature</sld:FeatureTypeName>
                <sld:SemanticTypeIdentifier>generic:geometry</sld:SemanticTypeIdentifier>
                <sld:SemanticTypeIdentifier>simple</sld:SemanticTypeIdentifier>
                <sld:Rule>
                    <sld:Name>Large</sld:Name>
                    <sld:MaxScaleDenominator>200.0</sld:MaxScaleDenominator>
                    <sld:PolygonSymbolizer>
					 <sld:Geometry>  
                            <ogc:Function name="isometric">  
                                <ogc:PropertyName>the_geom</ogc:PropertyName>  
                                <ogc:Literal>0.00001</ogc:Literal>  
                            </ogc:Function>  
                        </sld:Geometry>  
                        <sld:Fill>
                            <sld:CssParameter name="fill">#FFE7A6</sld:CssParameter>
                        </sld:Fill>
                        <sld:Stroke>
                            <sld:CssParameter name="stroke">#E8D1AE</sld:CssParameter>
                            <sld:CssParameter name="stroke-width">0.2</sld:CssParameter>
                        </sld:Stroke>
                    </sld:PolygonSymbolizer>
                    <sld:TextSymbolizer>
                        <sld:Label>
                            <ogc:PropertyName>number</ogc:PropertyName>
                        </sld:Label>
                        <sld:Font>
                            <sld:CssParameter name="font-family">Arial</sld:CssParameter>
                            <sld:CssParameter name="font-size">12.0</sld:CssParameter>
                            <sld:CssParameter name="font-style">normal</sld:CssParameter>
                            <sld:CssParameter name="font-weight">normal</sld:CssParameter>
                        </sld:Font>
                        <sld:LabelPlacement>
                            <sld:PointPlacement>
                                <sld:AnchorPoint>
                                    <sld:AnchorPointX>0.5</sld:AnchorPointX>
                                    <sld:AnchorPointY>0.5</sld:AnchorPointY>
                                </sld:AnchorPoint>
                                <sld:Displacement>
                                    <sld:DisplacementX>0.0</sld:DisplacementX>
                                    <sld:DisplacementY>0.0</sld:DisplacementY>
                                </sld:Displacement>
                                <sld:Rotation>
                                    <ogc:PropertyName>lblrotate</ogc:PropertyName>
                                </sld:Rotation>
                            </sld:PointPlacement>
                        </sld:LabelPlacement>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#404040</sld:CssParameter>
                        </sld:Fill>
                        <sld:VendorOption name="maxDisplacement">0</sld:VendorOption>
						<sld:VendorOption name="spaceAround">-5</sld:VendorOption>
                    </sld:TextSymbolizer>
                </sld:Rule>
                <sld:Rule>
                    <sld:Name>small</sld:Name>
                    <sld:MinScaleDenominator>200.0</sld:MinScaleDenominator>
                    <sld:MaxScaleDenominator>400.0</sld:MaxScaleDenominator>
                    <sld:PolygonSymbolizer>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#FFE7A6</sld:CssParameter>
                        </sld:Fill>
                        <sld:Stroke>
                            <sld:CssParameter name="stroke">#E8D1AE</sld:CssParameter>
                            <sld:CssParameter name="stroke-width">0.2</sld:CssParameter>
                        </sld:Stroke>
                    </sld:PolygonSymbolizer>
                    <sld:TextSymbolizer>
                        <sld:Label>
                            <ogc:PropertyName>number</ogc:PropertyName>
                        </sld:Label>
                        <sld:Font>
                            <sld:CssParameter name="font-family">Arial</sld:CssParameter>
                            <sld:CssParameter name="font-size">10.0</sld:CssParameter>
                            <sld:CssParameter name="font-style">normal</sld:CssParameter>
                            <sld:CssParameter name="font-weight">normal</sld:CssParameter>
                        </sld:Font>
                        <sld:LabelPlacement>
                            <sld:PointPlacement>
                                <sld:AnchorPoint>
                                    <sld:AnchorPointX>0.5</sld:AnchorPointX>
                                    <sld:AnchorPointY>0.5</sld:AnchorPointY>
                                </sld:AnchorPoint>
                                <sld:Displacement>
                                    <sld:DisplacementX>0.0</sld:DisplacementX>
                                    <sld:DisplacementY>0.0</sld:DisplacementY>
                                </sld:Displacement>
                                <sld:Rotation>
                                    <ogc:PropertyName>lblrotate</ogc:PropertyName>
                                </sld:Rotation>
                            </sld:PointPlacement>
                        </sld:LabelPlacement>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#404040</sld:CssParameter>
                        </sld:Fill>
                        <sld:VendorOption name="maxDisplacement">0</sld:VendorOption>
            <sld:VendorOption name="spaceAround">-5</sld:VendorOption>
                    </sld:TextSymbolizer>
                </sld:Rule>
         <sld:Rule>
                    <sld:Name>medium</sld:Name>
                    <sld:MinScaleDenominator>400.0</sld:MinScaleDenominator>
                    <sld:MaxScaleDenominator>600.0</sld:MaxScaleDenominator>
                    <sld:PolygonSymbolizer>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#FFE7A6</sld:CssParameter>
                        </sld:Fill>
                        <sld:Stroke>
                            <sld:CssParameter name="stroke">#E8D1AE</sld:CssParameter>
                            <sld:CssParameter name="stroke-width">0.2</sld:CssParameter>
                        </sld:Stroke>
                    </sld:PolygonSymbolizer>
                    <sld:TextSymbolizer>
                        <sld:Label>
                            <ogc:PropertyName>number</ogc:PropertyName>
                        </sld:Label>
                        <sld:Font>
                            <sld:CssParameter name="font-family">Arial</sld:CssParameter>
                            <sld:CssParameter name="font-size">6.0</sld:CssParameter>
                            <sld:CssParameter name="font-style">normal</sld:CssParameter>
                            <sld:CssParameter name="font-weight">normal</sld:CssParameter>
                        </sld:Font>
                        <sld:LabelPlacement>
                            <sld:PointPlacement>
                                <sld:AnchorPoint>
                                    <sld:AnchorPointX>0.5</sld:AnchorPointX>
                                    <sld:AnchorPointY>0.5</sld:AnchorPointY>
                                </sld:AnchorPoint>
                                <sld:Displacement>
                                    <sld:DisplacementX>0.0</sld:DisplacementX>
                                    <sld:DisplacementY>0.0</sld:DisplacementY>
                                </sld:Displacement>
                                <sld:Rotation>
                                    <ogc:PropertyName>lblrotate</ogc:PropertyName>
                                </sld:Rotation>
                            </sld:PointPlacement>
                        </sld:LabelPlacement>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#404040</sld:CssParameter>
                        </sld:Fill>
                        <sld:VendorOption name="maxDisplacement">0</sld:VendorOption>
            <sld:VendorOption name="spaceAround">-5</sld:VendorOption>
                    </sld:TextSymbolizer>
                </sld:Rule>
                <sld:Rule>
                    <sld:Name>Smallest</sld:Name>
                    <sld:MinScaleDenominator>600.0</sld:MinScaleDenominator>
                    <sld:PolygonSymbolizer>
                        <sld:Fill>
                            <sld:CssParameter name="fill">#FFE7A6</sld:CssParameter>
                        </sld:Fill>
                        <sld:Stroke>
                            <sld:CssParameter name="stroke">#E8D1AE</sld:CssParameter>
                            <sld:CssParameter name="stroke-width">0.2</sld:CssParameter>
                        </sld:Stroke>
                    </sld:PolygonSymbolizer>
                </sld:Rule>
            </sld:FeatureTypeStyle>
			<sld:FeatureTypeStyle>  
                <sld:Rule>
					<sld:Name>Large</sld:Name>
                    <sld:MaxScaleDenominator>200.0</sld:MaxScaleDenominator>				
                    <sld:PolygonSymbolizer>  
                        <sld:Geometry>  
                            <ogc:Function name="offset">  
                                <ogc:PropertyName>the_geom</ogc:PropertyName>  
                                <ogc:Literal>0</ogc:Literal>  
                                <ogc:Literal>0.00001</ogc:Literal>  
                            </ogc:Function>  
                        </sld:Geometry>  
                        <sld:Fill>  
                            <sld:CssParameter name="fill">#d8e5f2</sld:CssParameter>  
                        </sld:Fill>  
                        <sld:Stroke>  
                            <sld:CssParameter name="stroke">#999999</sld:CssParameter>  
                            <sld:CssParameter name="stroke-width">0.1</sld:CssParameter>  
                        </sld:Stroke>  
                    </sld:PolygonSymbolizer>  
                </sld:Rule>  
            </sld:FeatureTypeStyle>   
        </sld:UserStyle>
    </sld:UserLayer>
</sld:StyledLayerDescriptor>
  1. geowave 分布式渲染sld符号
<?xml version="1.0" encoding="ISO-8859-1"?>
<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>Distributed Render - Blue Line</Name>
		<UserStyle>
			<!-- Styles can have names, titles and abstracts -->
			<Title>Default Line with GeoWave Distributed Rendering enabled
			</Title>
			<Abstract>A sample style that draws a line using GeoWave's
				distributed rendering</Abstract>

			<FeatureTypeStyle>
				<Transformation>
					<ogc:Function name="geowave:DistributedRender">
						<ogc:Function name="parameter">
							<ogc:Literal>data</ogc:Literal>
						</ogc:Function>
					</ogc:Function>
				</Transformation>
				<Rule>

					<!--Here you can put any style rules you want, unrelated to DistributedRendering, 
						this line styling merely serves as an example -->
					<Name>rule1</Name>
					<Title>Blue Line</Title>
					<Abstract>A solid blue line with a 1 pixel width</Abstract>
					<LineSymbolizer>
						<Stroke>
							<CssParameter name="stroke">#0000FF</CssParameter>
						</Stroke>
					</LineSymbolizer>
				</Rule>
			</FeatureTypeStyle>
		</UserStyle>
	</NamedLayer>
</StyledLayerDescriptor>

7 文字符号:显示图层中字段值的sld符号

<?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>tk_text</Name>
    <UserStyle>
    <!-- Styles can have names, titles and abstracts -->
      <Title>tk_text</Title>
      <Abstract>A sample style that draws a polygon</Abstract>
      <!-- FeatureTypeStyles describe how to render different features -->
      <!-- A FeatureTypeStyle for rendering polygons -->
      <FeatureTypeStyle>
        <Rule>
          <Name>rule1</Name>
          <Title>Gray Polygon with Black Outline</Title>
          <Abstract>A polygon with a gray fill and a 1 pixel black outline</Abstract>
          <PolygonSymbolizer>
            <Fill>
              <CssParameter name="fill">#AAAAAA</CssParameter>
              <CssParameter name="fill-opacity">0</CssParameter>
            </Fill>
            <Stroke>
              <CssParameter name="stroke">#0000FF</CssParameter>
              <CssParameter name="stroke-width">0.5</CssParameter>
            </Stroke>
          </PolygonSymbolizer>
          <TextSymbolizer>
                         <Label>
                             <PropertyName>TIER_ID</PropertyName>
                         </Label>
                         <Font>
                             <CssParameter name="font-family">@宋体</CssParameter>
                             <CssParameter name="font-size">14.0</CssParameter>
                             <CssParameter name="font-style">normal</CssParameter>
                             <CssParameter name="font-weight">bold</CssParameter>
                         </Font>
                         <LabelPlacement>
                             <PointPlacement>
                                 <AnchorPoint>
                                     <AnchorPointX>0.5</AnchorPointX>
                                     <AnchorPointY>0.5</AnchorPointY>
                                 </AnchorPoint>
                             </PointPlacement>
                         </LabelPlacement>
                         <Fill>
                             <CssParameter name="fill">#000000</CssParameter>
                         </Fill>
                         <VendorOption name="autoWrap">60</VendorOption>
                         <VendorOption name="maxDisplacement">150</VendorOption>
                     </TextSymbolizer>
        </Rule>
      </FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

参考来源
geoserver 安装环境
https://blog.csdn.net/longshengguoji/article/details/51008176

转载自:https://blog.csdn.net/hsg77/article/details/85159513

You may also like...