GeoServer에서 사용가능한 SLD(Styled Layer Descriptor) 샘플입니다.
cotype 이라는 필드(아래에서 <ogc:PropertyName>cotype</ogc:PropertyName>) 이름을 사용하므로 다른 레이어에서는 필드 이름 및 값을 바꿔주면 됩니다.
Unique Value Renderer 이므로 Filter를 응용하면 Graduated Color, Graduated Symbol 등 거의 모든 Polygon Symbolizing이 가능합니다.
▣ SLD 참고
- Geoserver SLD Cookbook
▣ Legend
▣ Map: GeoServer + OpenLayers
▣ SLD
<?xml version="1.0" encoding="utf-8"?>
<StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd">
<NamedLayer>
<Name>Local_Moran's I Cluster Map</Name>
<UserStyle>
<Name>Cluster Map</Name>
<Title>Cluster Map</Title>
<Abstract>Cluster Map</Abstract>
<FeatureTypeStyle>
<Rule>
<Title>HH</Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>cotype</ogc:PropertyName>
<ogc:Literal>HH</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FF6347</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#6E6E6E</CssParameter>
<CssParameter name="stroke-width">0.5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<Title>LH</Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>cotype</ogc:PropertyName>
<ogc:Literal>LH</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FAFAD2</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#6E6E6E</CssParameter>
<CssParameter name="stroke-width">0.5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<Title>LL</Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>cotype</ogc:PropertyName>
<ogc:Literal>LL</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#6495ED</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#6E6E6E</CssParameter>
<CssParameter name="stroke-width">0.5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<Title>HL</Title>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>cotype</ogc:PropertyName>
<ogc:Literal>HL</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#D8BFD8</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#6E6E6E</CssParameter>
<CssParameter name="stroke-width">0.5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<Title>Not Significant</Title>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsNull>
<ogc:PropertyName>cotype</ogc:PropertyName>
</ogc:PropertyIsNull>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>cotype</ogc:PropertyName>
<ogc:Literal></ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#6E6E6E</CssParameter>
<CssParameter name="stroke-width">0.5</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
댓글 없음:
댓글 쓰기