无法使用XML在开放层中查看数据样式

时间:2015-11-22 22:59:22

标签: xml postgresql postgis geoserver

我已经为postGIS上传了数据,现在我想在geoserver中设置数据的样式。我这是用XML完成的。调整代码后,我收到一条错误消息:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" >   <ServiceException>
  The requested Style can not be used with this layer.  The style specifies an attribute of PolygonAcres and the layer is: lab4:wa_publiclandsinventory_2014_publicinfo

以下是我的XML代码,该代码已被更改为显示WA状态下的两组数据大型公园和小型公园,这些数据集来自从WA GIS数据库下载的全州数据集here

<?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:NamedLayer>
<sld:Name>public_land_classificiation</sld:Name>
<sld:UserStyle>
<sld:Name>public_land_classification</sld:Name>
<sld:Title>Public Land classification</sld:Title>
<sld:FeatureTypeStyle>
<sld:Name>name</sld:Name>
<sld:Rule>
<sld:Title>Large Parks</sld:Title>
<ogc:Filter>
<ogc:PropertyIsGreaterThanOrEqualTo>
<ogc:PropertyName>PolygonAcres
</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsGreaterThanOrEqualTo>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter
name="fill">#FF0000</sld:CssParameter>
</sld:Fill>
<sld:Stroke/>
</sld:PolygonSymbolizer>
</sld:Rule>
<sld:Rule>
<sld:Title>Small Parks</sld:Title>
<ogc:Filter>
<ogc:PropertyIsLessThan>
<ogc:PropertyName>PolygonAcres
</ogc:PropertyName>
<ogc:Literal>2</ogc:Literal>
</ogc:PropertyIsLessThan>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter
name="fill">#0000FF</sld:CssParameter>
</sld:Fill>
<sld:Stroke/>
</sld:PolygonSymbolizer>
  </sld:Rule>  
</sld:FeatureTypeStyle>
</sld:UserStyle>
</sld:NamedLayer>
</sld:StyledLayerDescriptor>

PolygonAcres是一个数值为0-70000英亩左右的属性。我尝试过使用其他属性,但使用该属性获得基本相同的错误等于州,联邦和地方政府使用三个&#34;规则&#34;以不同的颜色设计。如果您需要更多信息,请与我们联系。

1 个答案:

答案 0 :(得分:0)

您在propertyName的末尾有一个返回值,因此请更改

<ogc:PropertyName>PolygonAcres
</ogc:PropertyName>

<ogc:PropertyName>PolygonAcres</ogc:PropertyName>
相关问题