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

多行标注样式的sld

程序员文章站 2022-05-01 19:41:47

标注样式为:
多行标注样式的sld
以上样式实现代码为:

<?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></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>ID</ogc:PropertyName>
                <ogc:Literal>0</ogc:Literal>
                <ogc:Literal>5</ogc:Literal>
              </ogc:Function><![CDATA[
]]><ogc:Literal>─────</ogc:Literal>
              <ogc:Literal><![CDATA[
]]></ogc:Literal>
              <ogc:PropertyName>CODE</ogc:PropertyName>
              <ogc:Literal><![CDATA[
]]></ogc:Literal>
              <ogc:PropertyName>NAME</ogc:PropertyName>
            </se:Label>
            <se:Font>
              <se:SvgParameter name="font-family">SimSun</se:SvgParameter>
              <se:SvgParameter name="font-size">12</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="maxDisplacement">30</se:VendorOption>
            <se:VendorOption name="polygonAlign">ortho</se:VendorOption>
          </se:TextSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

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

相关标签: geoserver