我已经从(http://download.geofabrik.de/asia/nepal.html
)下载了形状文件中的OSM地图,我有多个形状文件,如Roads,Building,landuse等。
我想在我的地理服务器中发布这些文件,我没有问题。我很容易做到。现在问题是为每种类型创建SLD。我在互联网上下载了各种SLD。但到目前为止还没有运气。每次我使用任何SLD我都无法查看我的图层。错误消息如下所示:
请求的样式不能与此图层一起使用。样式指定了landuse的属性,图层为:main:landuse
我的形状文件属性中有4列(fid,osm_id,name,type)。
我的SLD看起来像这样:
<?xml version="1.0" encoding="utf-8"?>
<StyledLayerDescriptor xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ogc="http://www.opengis.net/ogc" xmlns="http://www.opengis.net/sld" version="1.0.0">
<NamedLayer>
<Name>landuse_overlay</Name>
<UserStyle>
<Name>landuse_overlay</Name>
<FeatureTypeStyle>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>landuse</ogc:PropertyName>
<ogc:Literal>military</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>750000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="/var/lib/geoserver_data/Test/rogue_symbols/military_red_hz2.png"/>
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-opacity">0.329</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke">#ff5555</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>leisure</ogc:PropertyName>
<ogc:Literal>nature_reserve</ogc:Literal>
</ogc:PropertyIsEqualTo>
</Filter>
<MinScaleDenominator>50000</MinScaleDenominator>
<MaxScaleDenominator>750000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="/var/lib/geoserver_data/Test/rogue_symbols/nature_reserve5.png"/>
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-opacity">0.5</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
<CssParameter name="stroke">#66cc33</CssParameter>
<CssParameter name="strok-dasharray">5 2</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
<Halo>
<Radius>5</Radius>
<Fill>
<CssParameter name="fill">#ffffff</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#66cc33</CssParameter>
</Fill>
<VendorOption name="autoWrap">60</VendorOption>
</TextSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>leisure</ogc:PropertyName>
<ogc:Literal>nature_reserve</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>50000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="/var/lib/geoserver_data/Test/rogue_symbols/nature_reserve6.png"/>
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-opacity">0.5</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke">#66cc33</CssParameter>
<CssParameter name="stroke-dasharray">5 2</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:And>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>boundary</ogc:PropertyName>
<ogc:Literal>national_park</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsNull>
<ogc:PropertyName>leisure</ogc:PropertyName>
</ogc:PropertyIsNull>
</ogc:And>
</ogc:Filter>
<MaxScaleDenominator>1000000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#08a136</CssParameter>
<CssParameter name="fill-opacity">.3</CssParameter>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#66cc33</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Filter xmlns="http://www.opengis.net/ogc">
<Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>leisure</ogc:PropertyName>
<ogc:Literal>park</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>leisure</ogc:PropertyName>
<ogc:Literal>recreation_ground</ogc:Literal>
</ogc:PropertyIsEqualTo>
</Or>
</Filter>
<MaxScaleDenominator>750000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill-opacity">0.6</CssParameter>
<CssParameter name="fill">#b6fdb6</CssParameter>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-opacity">0.5</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
<CssParameter name="stroke">#66cc33</CssParameter>
<CssParameter name="strok-dasharray">5 2</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label>
<ogc:PropertyName>name</ogc:PropertyName>
</Label>
<Halo>
<Radius>5</Radius>
<Fill>
<CssParameter name="fill">#ffffff</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#66cc33</CssParameter>
</Fill>
<VendorOption name="autoWrap">60</VendorOption>
</TextSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>landuse</ogc:PropertyName>
<ogc:Literal>quarry</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>750000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="/var/lib/geoserver_data/Test/rogue_symbols/quarry2.png"/>
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-opacity">0.329</CssParameter>
<CssParameter name="stroke-width">.5</CssParameter>
<CssParameter name="stroke">#829495</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Filter xmlns="http://www.opengis.net/ogc">
<PropertyIsEqualTo>
<PropertyName>landuse</PropertyName>
<Literal>vineyard</Literal>
</PropertyIsEqualTo>
</Filter>
<MinScaleDenominator>100000</MinScaleDenominator>
<MaxScaleDenominator>750000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#abdf96</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<Filter xmlns="http://www.opengis.net/ogc">
<PropertyIsEqualTo>
<PropertyName>landuse</PropertyName>
<Literal>vineyard</Literal>
</PropertyIsEqualTo>
</Filter>
<MaxScaleDenominator>100000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="/var/lib/geoserver_data/Test/rogue_symbols/vineyard.png"/>
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>landuse</ogc:PropertyName>
<ogc:Literal>orchard</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>250000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<GraphicFill>
<Graphic>
<ExternalGraphic>
<OnlineResource xlink:href="/var/lib/geoserver_data/Test/rogue_symbols/orchard.png"/>
<Format>image/png</Format>
</ExternalGraphic>
</Graphic>
</GraphicFill>
</Fill>
</PolygonSymbolizer>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke-opacity">0.5</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke">#abd190</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>landuse</ogc:PropertyName>
<ogc:Literal>industrial</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>500000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#beb8c1</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>landuse</ogc:PropertyName>
<ogc:Literal>reservoir</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>500000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#b5d0d0</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<ogc:Filter xmlns="http://www.opengis.net/ogc">
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>leisure</ogc:PropertyName>
<ogc:Literal>sports_centre</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<MaxScaleDenominator>250000</MaxScaleDenominator>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#64c397</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
谁能告诉我,我在这里做错了什么?
AJ
答案 0 :(得分:1)
The SLD style was designed to work against a OSM dump with a "landuse" attribute that your does not. There are many ways to extract data from the raw OSM files, and they lead to different layer and attribute layouts, but a given SLD will work only against a specific one. You will have to either find SLDs that work against the structure of your shapefiles, or adapt the styles to use the attributes that you have