【第六章 WebGIS】geoserver生成点聚合效果 - 知乎
需要WPS插件,注意版本要对应 GeoServer,加压缩后的jar包放到geoserver的lib目录下,重启geoserver。

原始默认样式

聚合sld样式
- <?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>g_stacker</Name>
- <UserStyle>
- <Title>Point Stacker</Title>
- <Abstract>A sample style that aggregates points</Abstract>
- <FeatureTypeStyle>
- <Transformation>
- <ogc:Function name="gs:PointStacker">
- <ogc:Function name="parameter">
- <ogc:Literal>data</ogc:Literal>
- </ogc:Function>
- <ogc:Function name="parameter">
- <ogc:Literal>cellSize</ogc:Literal>
- <ogc:Literal>30</ogc:Literal> <!--聚合半径-->
- </ogc:Function>
- <ogc:Function name="parameter">
- <ogc:Literal>outputBBOX</ogc:Literal>
- <ogc:Function name="env">
- <ogc:Literal>wms_bbox</ogc:Literal>
- </ogc:Function>
- </ogc:Function>
- <ogc:Function name="parameter">
- <ogc:Literal>outputWidth</ogc:Literal>
- <ogc:Function name="env">
- <ogc:Literal>wms_width</ogc:Literal>
- </ogc:Function>
- </ogc:Function>
- <ogc:Function name="parameter">
- <ogc:Literal>outputHeight</ogc:Literal>
- <ogc:Function name="env">
- <ogc:Literal>wms_height</ogc:Literal>
- </ogc:Function>
- </ogc:Function>
- </ogc:Function>
- </Transformation>
- <Rule>
- <PointSymbolizer>
- <Graphic>
- <Mark>
- <WellKnownName>circle</WellKnownName>
- <Fill>
- <CssParameter name="fill">#0000FF</CssParameter>
- <CssParameter name="fill-opacity">0.5</CssParameter>
- </Fill>
- </Mark>
- <Size>25</Size>
- </Graphic>
- </PointSymbolizer>
- <TextSymbolizer>
- <Label>
- <ogc:PropertyName>countunique</ogc:PropertyName>
- </Label>
- <Font>
- <CssParameter name="font-family">Arial</CssParameter>
- <CssParameter name="font-size">12.0</CssParameter>
- <CssParameter name="font-style">normal</CssParameter>
- <CssParameter name="font-weight">normal</CssParameter>
- </Font>
- <LabelPlacement>
- <PointPlacement>
- <AnchorPoint>
- <AnchorPointX>0.5</AnchorPointX>
- <AnchorPointY>0.5</AnchorPointY>
- </AnchorPoint>
- <Displacement>
- <DisplacementX>0</DisplacementX>
- <DisplacementY>0</DisplacementY>
- </Displacement>
- <Rotation>
- <ogc:Literal>0.0</ogc:Literal>
- </Rotation>
- </PointPlacement>
- </LabelPlacement>
- <Halo>
- <Radius>2</Radius>
- <Fill>
- <CssParameter name="fill">#FFFFFF</CssParameter>
- </Fill>
- </Halo>
- <Fill>
- <CssParameter name="fill">#000000</CssParameter>
- </Fill>
- </TextSymbolizer>
- </Rule>
- </FeatureTypeStyle>
- </UserStyle>
- </NamedLayer>
- </StyledLayerDescriptor>
结果样式
