GeoServer模仿GoogleMap风格写sld
[color=green]Polygon:[/color]
[img]http://dl.iteye.com/upload/attachment/0073/0084/e466c63d-84ef-3ded-8c08-1823fa66f78f.png[/img]
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
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">
<NamedLayer>
<Name>masmap polygons</Name>
<UserStyle>
<Title>masmap polygons</Title>
<Abstract>masmap polygons</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>park</Name>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>30</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>32</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>80</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#B5D29C</CssParameter>
</Fill>
</PolygonSymbolizer>
</Rule>
<Rule>
<Name>building</Name>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>8</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>13</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>16</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>17</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>18</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>19</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Or>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#C6C5C2</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#999999</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<Name>water</Name>
<ogc:Filter>
<ogc:Or>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>73</ogc:Literal>
</ogc:PropertyIsEqualTo>
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>50</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>79</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Or>
</ogc:Filter>
<PolygonSymbolizer>
<Fill>
<CssParameter name="fill">#99B3CC</CssParameter>
</Fill>
<Stroke>
<CssParameter name="stroke">#99B3CC</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
</Stroke>
</PolygonSymbolizer>
</Rule>
<Rule>
<Name>label</Name>
<MaxScaleDenominator>31780</MaxScaleDenominator>
<TextSymbolizer>
<Label><ogc:PropertyName>label</ogc:PropertyName></Label>
<Font>
<CssParameter name="font-family">Tahoma</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">10</CssParameter>
</Font>
<LabelPlacement>
<PointPlacement>
<AnchorPoint>
<AnchorPointX>0.5</AnchorPointX>
<AnchorPointY>0.5</AnchorPointY>
</AnchorPoint>
<Displacement>
<DisplacementX>0</DisplacementX>
<DisplacementY>0</DisplacementY>
</Displacement>
</PointPlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#003366</CssParameter>
</Fill>
<VendorOption name="spaceAround">5</VendorOption>
<VendorOption name="group">yes</VendorOption>
<VendorOption name="autoWrap">75</VendorOption>
</TextSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
[color=green]Roads:[/color]
[img]http://dl.iteye.com/upload/attachment/0073/0092/53d1ed93-cd7d-358d-817a-337528eb77d6.png[/img]
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
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">
<NamedLayer>
<Name>masmap roads</Name>
<UserStyle>
<Title>masmap roads</Title>
<Abstract>masmap roads</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>Text and polyline for major_highways</Name>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>1</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>3</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#FFC345</CssParameter>
<CssParameter name="stroke-width">6</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
<TextSymbolizer>
<Label><ogc:PropertyName>label</ogc:PropertyName></Label>
<Font>
<CssParameter name="font-family">Tahoma</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">10</CssParameter>
</Font>
<LabelPlacement>
<LinePlacement>
<PerpendicularOffset>1</PerpendicularOffset>
</LinePlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="group">yes</VendorOption>
<VendorOption name="followLine">true</VendorOption>
</TextSymbolizer>
</Rule>
<Rule>
<Name>Text label for non highway</Name>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>4</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>22</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<TextSymbolizer>
<Label><ogc:PropertyName>label</ogc:PropertyName></Label>
<Font>
<CssParameter name="font-family">Tahoma</CssParameter>
<CssParameter name="font-style">Normal</CssParameter>
<CssParameter name="font-size">9</CssParameter>
</Font>
<LabelPlacement>
<LinePlacement>
<PerpendicularOffset>1</PerpendicularOffset>
</LinePlacement>
</LabelPlacement>
<Halo>
<Radius>
<ogc:Literal>2</ogc:Literal>
</Radius>
<Fill>
<CssParameter name="fill">#FFFFFF</CssParameter>
<CssParameter name="fill-opacity">0.85</CssParameter>
</Fill>
</Halo>
<Fill>
<CssParameter name="fill">#000000</CssParameter>
</Fill>
<VendorOption name="group">yes</VendorOption>
<VendorOption name="followLine">true</VendorOption>
</TextSymbolizer>
</Rule>
<Rule>
<Name>0x05, 0x04, collector, arterial</Name>
<ogc:Filter>
<!-- 4 - 5 -->
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>4</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>5</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#FFFD8B</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Name>0x09, 0x08, 0xc ramps, roundabouts</Name>
<ogc:Filter>
<!-- 8 - 12 -->
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>8</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>12</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#FFE068</CssParameter>
<CssParameter name="stroke-width">4</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Name>0x06_residential_road</Name>
<ogc:Filter>
<!-- 6 -->
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>6</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#ffffff</CssParameter>
<CssParameter name="stroke-width">2</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Name>all else</Name>
<ogc:Filter>
<ogc:Or>
<!-- 7 -->
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>7</ogc:Literal>
</ogc:PropertyIsEqualTo>
<!-- >12 -->
<ogc:PropertyIsGreaterThan>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>13</ogc:Literal>
</ogc:PropertyIsGreaterThan>
</ogc:Or>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#999999</CssParameter>
<CssParameter name="stroke-width">1</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
[color=green]Road border:[/color]
[img]http://dl.iteye.com/upload/attachment/0073/0090/9becd73c-8aba-35c7-ae1d-e5440919278c.gif[/img]
<?xml version="1.0" encoding="ISO-8859-1"?>
<StyledLayerDescriptor version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
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">
<NamedLayer>
<Name>masmap road border</Name>
<UserStyle>
<Title>masmap road border</Title>
<Abstract>masmap road border</Abstract>
<FeatureTypeStyle>
<Rule>
<Name>0x06_residential_road</Name>
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:Literal>6</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#999999</CssParameter>
<CssParameter name="stroke-width">3</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Name>0x05, 0x04, collector, arterial</Name>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>4</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>5</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">5</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Name>0x09, 0x08, 0xc ramps, roundabouts</Name>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>8</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>12</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">5</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
<Rule>
<Name>0x01, 0x02, 0x03 major_highways</Name>
<ogc:Filter>
<ogc:PropertyIsBetween>
<ogc:PropertyName>type</ogc:PropertyName>
<ogc:LowerBoundary>
<ogc:Literal>1</ogc:Literal>
</ogc:LowerBoundary>
<ogc:UpperBoundary>
<ogc:Literal>3</ogc:Literal>
</ogc:UpperBoundary>
</ogc:PropertyIsBetween>
</ogc:Filter>
<LineSymbolizer>
<Stroke>
<CssParameter name="stroke">#000000</CssParameter>
<CssParameter name="stroke-width">7</CssParameter>
<CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</CssParameter>
<CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</CssParameter>
</Stroke>
</LineSymbolizer>
</Rule>
</FeatureTypeStyle>
</UserStyle>
</NamedLayer>
</StyledLayerDescriptor>
[color=green]合成后的风格[/color]
[img]http://dl.iteye.com/upload/attachment/0073/0094/c36f63d5-9a51-3d8e-bba8-21f4bdbbc606.png[/img]
转载自:https://blog.csdn.net/iteye_15538/article/details/82405011