欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

sld样式文件demo

程序员文章站 2022-06-24 20:54:07

标注样式为:
sld样式文件demo
代码为:

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:se="http://www.opengis.net/se" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:ogc="http://www.opengis.net/ogc">
  <NamedLayer>
    <se:Name>gis_inner_702872535642697728</se:Name>
    <UserStyle>
      <se:Name>gis_inner_702872535642697728</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>样式demo</se:Name>
          <se:PolygonSymbolizer>
            <se:Stroke>
              <se:SvgParameter name="stroke">#232323</se:SvgParameter>
              <se:SvgParameter name="stroke-width">1</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:TextSymbolizer>
            <se:Label>
              <!--截取字段部分字符串作为标注-->
              <ogc:Function name="strSubstring">
                <ogc:PropertyName>bdcdyh</ogc:PropertyName>
                <ogc:Literal>12</ogc:Literal>
                <ogc:Literal>19</ogc:Literal>
              </ogc:Function>
            </se:Label>
            <se:Font>
              <se:SvgParameter name="font-family">SimSun</se:SvgParameter>
              <se:SvgParameter name="font-size">6</se:SvgParameter>
              <se:SvgParameter name="font-style">normal</se:SvgParameter>
              <se:SvgParameter name="font-weight">bold</se:SvgParameter>
            </se:Font>
            <se:LabelPlacement>
              <se:PointPlacement>
                <se:AnchorPoint>
                  <se:AnchorPointX>0.5</se:AnchorPointX>
                  <se:AnchorPointY>0.5</se:AnchorPointY>
                </se:AnchorPoint>
                <se:Displacement>
                  <se:DisplacementX>1.0</se:DisplacementX>
                  <se:DisplacementY>7.0</se:DisplacementY>
                </se:Displacement>
              </se:PointPlacement>
            </se:LabelPlacement>
            <se:Fill>
              <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
            </se:Fill>
            <se:VendorOption name="conflictResolution">false</se:VendorOption>
            <se:VendorOption name="polygonAlign">ortho</se:VendorOption>
            <se:VendorOption name="spaceAround">-1</se:VendorOption>
          </se:TextSymbolizer>
          <se:TextSymbolizer>
            <se:Label>            
              <ogc:Literal>───</ogc:Literal> 
            </se:Label>
            <se:Font>
              <se:SvgParameter name="font-family">SimSun</se:SvgParameter>
              <se:SvgParameter name="font-size">7</se:SvgParameter>
              <se:SvgParameter name="font-style">normal</se:SvgParameter>
              <se:SvgParameter name="font-weight">bold</se:SvgParameter>
            </se:Font>
            <se:LabelPlacement>
              <se:PointPlacement>
                <se:AnchorPoint>
                  <se:AnchorPointX>0.5</se:AnchorPointX>
                  <se:AnchorPointY>0.5</se:AnchorPointY>
                </se:AnchorPoint>
                <se:Displacement>
                  <se:DisplacementX>1.0</se:DisplacementX>
                  <se:DisplacementY>1.0</se:DisplacementY>
                </se:Displacement>
              </se:PointPlacement>
            </se:LabelPlacement>
            <se:Fill>
              <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
            </se:Fill>
            <se:VendorOption name="conflictResolution">false</se:VendorOption>
            <se:VendorOption name="spaceAround">-1</se:VendorOption>
            <se:VendorOption name="polygonAlign">ortho</se:VendorOption>
          </se:TextSymbolizer>
          <se:TextSymbolizer>
            <se:Label>
              <!--保留小数点后两位-->
              <ogc:Function name="numberFormat">
                <ogc:Literal>###.##</ogc:Literal>
                <ogc:PropertyName>zdmj</ogc:PropertyName>
              </ogc:Function>
            </se:Label>
            <se:Font>
              <se:SvgParameter name="font-family">SimSun</se:SvgParameter>
              <se:SvgParameter name="font-size">6</se:SvgParameter>
              <se:SvgParameter name="font-style">normal</se:SvgParameter>
              <se:SvgParameter name="font-weight">bold</se:SvgParameter>
            </se:Font>
            <se:LabelPlacement>
              <se:PointPlacement>
                <se:AnchorPoint>
                  <se:AnchorPointX>0.5</se:AnchorPointX>
                  <se:AnchorPointY>0.5</se:AnchorPointY>
                </se:AnchorPoint>
                <se:Displacement>
                  <se:DisplacementX>3.0</se:DisplacementX>
                  <se:DisplacementY>0.5</se:DisplacementY>
                </se:Displacement>
              </se:PointPlacement>
            </se:LabelPlacement>
            <se:Fill>
              <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
            </se:Fill>
            <se:VendorOption name="conflictResolution">false</se:VendorOption>
            <se:VendorOption name="spaceAround">-10</se:VendorOption>
            <se:VendorOption name="polygonAlign">ortho</se:VendorOption>
          </se:TextSymbolizer>
          <se:TextSymbolizer>
            <se:Label>            
                <ogc:PropertyName>qlrmc</ogc:PropertyName>
            </se:Label>
            <se:Font>
              <se:SvgParameter name="font-family">SimSun</se:SvgParameter>
              <se:SvgParameter name="font-size">6</se:SvgParameter>
              <se:SvgParameter name="font-style">normal</se:SvgParameter>
              <se:SvgParameter name="font-weight">bold</se:SvgParameter>
            </se:Font>
            <se:LabelPlacement>
              <se:PointPlacement>
                <se:AnchorPoint>
                  <se:AnchorPointX>0.5</se:AnchorPointX>
                  <se:AnchorPointY>0.5</se:AnchorPointY>
                </se:AnchorPoint>
                <se:Displacement>
                  <se:DisplacementX>2.0</se:DisplacementX>
                  <se:DisplacementY>-4.0</se:DisplacementY>
                </se:Displacement>
              </se:PointPlacement>
            </se:LabelPlacement>
            <se:Fill>
              <se:SvgParameter name="fill">#ff0000</se:SvgParameter>
            </se:Fill>
            <se:VendorOption name="conflictResolution">false</se:VendorOption>
            <se:VendorOption name="spaceAround">-1</se:VendorOption>
          </se:TextSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

本文地址:https://blog.csdn.net/ylfmsn/article/details/107654086

相关标签: geoserver