QGIS中生成的geoserver中的样式显示不完整

Posted

技术标签:

【中文标题】QGIS中生成的geoserver中的样式显示不完整【英文标题】:Incomplete display of style in geoserver generated in QGIS 【发布时间】:2015-09-22 07:31:59 【问题描述】:

QGIS 2.10 PISA中生成的SLD如下-

<?xml version="1.0" encoding="UTF-8"?>
<StyledLayerDescriptor xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.1.0/StyledLayerDescriptor.xsd" xmlns:se="http://www.opengis.net/se">
  <NamedLayer>
    <se:Name>state1</se:Name>
    <UserStyle>
      <se:Name>state1</se:Name>
      <se:FeatureTypeStyle>
        <se:Rule>
          <se:Name>ADJACENT COUNTRIES</se:Name>
          <se:Description>
            <se:Title>ADJACENT COUNTRIES</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>STATE</ogc:PropertyName>
              <ogc:Literal>ADJACENT COUNTRIES</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#d640d1</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>ANDAMAN &amp; NICOBAR</se:Name>
          <se:Description>
            <se:Title>ANDAMAN &amp; NICOBAR</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>STATE</ogc:PropertyName>
              <ogc:Literal>ANDAMAN &amp; NICOBAR</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#62eadf</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>ANDHRA PRADESH</se:Name>
          <se:Description>
            <se:Title>ANDHRA PRADESH</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>STATE</ogc:PropertyName>
              <ogc:Literal>ANDHRA PRADESH</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#869edf</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>ARUNACHAL PRADESH</se:Name>
          <se:Description>
            <se:Title>ARUNACHAL PRADESH</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>STATE</ogc:PropertyName>
              <ogc:Literal>ARUNACHAL PRADESH</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#85e6ee</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
        <se:Rule>
          <se:Name>ASSAM</se:Name>
          <se:Description>
            <se:Title>ASSAM</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>STATE</ogc:PropertyName>
              <ogc:Literal>ASSAM</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#aede72</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
  <se:Name></se:Name>
          <se:Description>
            <se:Title>STATE is ''</se:Title>
          </se:Description>
          <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>STATE</ogc:PropertyName>
              <ogc:Literal></ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <se:PolygonSymbolizer>
            <se:Fill>
              <se:SvgParameter name="fill">#ebcf60</se:SvgParameter>
            </se:Fill>
            <se:Stroke>
              <se:SvgParameter name="stroke">#000000</se:SvgParameter>
              <se:SvgParameter name="stroke-width">0.26</se:SvgParameter>
              <se:SvgParameter name="stroke-linejoin">bevel</se:SvgParameter>
            </se:Stroke>
          </se:PolygonSymbolizer>
        </se:Rule>
      </se:FeatureTypeStyle>
    </UserStyle>
  </NamedLayer>
</StyledLayerDescriptor>

当将上述 SLD 作为样式添加到 GeoServer 2.7.2 中的其中一个图层并作为 wms 发布时,无法显示标签(状态名称)。在 SLD 中,仅对状态进行分类并为其命名。 有人可以帮我解决这个问题。

【问题讨论】:

【参考方案1】:

SLD 不包含任何 TextSymbolizer,因此无法显示标签。如果您配置了标签,您应该将缺少 TextSymbolizer 报告为 QGis 中的错误

【讨论】:

感谢您的回复。由于已经配置了标签,所以在qgis中似乎是一个bug,因为上面的sld已经在QGIS中生成了。

以上是关于QGIS中生成的geoserver中的样式显示不完整的主要内容,如果未能解决你的问题,请参考以下文章

GeoServer中使用样式化图层描述符(sld)加注记

qgis中加载矢量切片

QGIS 与 Geomesa 或 GeoServer 的集成

GeoServer中sld文件的获取来源

QGIS SERVER QGIS 用于 发布环境WEB 地图

qgis中加载矢量切片