# 基本信息

# WMS服务

网络地图服务

  • GetMap:获取地图
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.1&request=GetMap&layers=your-layer&styles=&format=image/png&transparent=true&width=800&height=600&bbox=-180,-90,180,90&srs=EPSG:4326
service=WMS # 请求服务类型
version=1.1.1 # 请求的 WMS 版本,例如 1.1.1、1.3.0
request=GetMap # 请求地图
layers=space:your-layer # 要显示的图层
styles= # 使用的样式(空白表示默认样式)
format=image/png # 返回图像格式为 PNG
transparent=true # 是否透明背景,通常设置为 true 或 false
width=800&height=600 # 输出图像的宽度和高度
bbox=-180,-90,180,90 # 地图的边界框(minx, miny, maxx, maxy)
srs=EPSG:4326 # 坐标参考系统(在 1.1.1 中用 srs,1.3.0中用 crs)
featureid=map_pts.291393 # 图层中要素id,多个以,隔开,缺失查询所有要素
cql_filter=1=1  # 查询过滤器
  • GetFeatureInfo:参数width和height是bbox范围生成的一小块图片,查询图片中位置是x、y的要素信息
# WMS 虽然主要的用途是请求地图图片,是一种经典的服务器渲染服务,但是也保留了基本的要素查询功能
# WMS 请求的 GetFeatureInfo 服务通常默认使用地理坐标系(例如 EPSG:4326)来请求空间数据
# 这是由于WMS规定在 GetFeatureInfo 请求中,使用地理坐标系统来查询位置,而不是投影系统(EPSG:3857)

http://localhost:8080/geoserver/wms?service=WMS&version=1.1.1&request=GetFeatureInfo&layers=your-layer&query_layers=your-layer&info_format=text/html&x=200&y=150&width=800&height=600&bbox=-180,-90,180,90&srs=EPSG:4326
request=GetFeatureInfo # 指定用于查询的图层
query_layers=space:your-layer # 指定用于查询的图层(在 GetFeatureInfo 请求中使用)
info_format=text/html # 返回的信息格式
x=200&y=150 # 鼠标点击位置的坐标(相对于图像)
width=800&height=600 # 输出图像的宽度和高度
bbox=-180,-90,180,90 # 地图的边界框
srs=EPSG:4326 # 坐标参考系统
  • GetCapabilities:获取服务能力
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.1&request=GetCapabilities
request=GetCapabilities # 请求服务能力文档,提供关于服务、图层和其他功能的信息
http://localhost:8080/geoserver/wms?request=GetLegendGraphic&version=1.0.0&format=image/png&width=20&height=20&layer=topp:states

# 也可以在GetMap接口路径后面拼接上一下参数来生成,主要是需要第一个参数设置layout文件路径
&format_options=layout:style-editor-legend&legend_options=forceLabels:on;countMatched:true;fontAntiAliasing:true

# 注意,必须是 Single Tile 即:ImageWMS 这样才能整个地图显示一个图例
# 图例位置调整:geoserver的数据目录 G:\GIS\GeoServer\data\layouts\style-editor-legend.xml

<layout>
    <decoration type="image" affinity="bottom,right" offset="6,6" size="80,31">
        <option name="url" value="pbGS_80x31glow.png"/>
    </decoration>
    <decoration type="scaleline" affinity="bottom,left" offset="36,6"/>
    <decoration type="legend" affinity="top,left" offset="6,6" size="auto"/>
</layout>

# WFS服务

网络要素服务,并提供对要素的增删改等操作

  • GetFeature:获取要素实例
http://localhost:8080/geoserver/utum/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=topp:states&featureid=429004.15&maxFeatures=50&outputFormat=json
service=WFS # 请求服务类型
version=1.0.0 # 请求的 WFS 版本
request=GetFeature # 表示请求调用的方法,这里为 GetFeature 请求要素信息
typeName=topp:states # 请求图层
maxFeatures=50 # 最大特征数量(1.0.0用maxFeatures限制返回数量,2.0.0用count限制)
sortBy # 指定属性排序
outputFormat # 返回要素的属性数据类型,常用类型text/xml、text/html、text/plain、application/json
propertyName=pid # 根据属性搜索(只返回传入的属性,多个以逗号隔开)
featureid=map_pts.291393 # 图层中要素id,多个以,隔开,缺失查询所有要素
cql_filter=1=1 # 查询过滤器
  • DescribeFeatureType:返回图层描述信息(图层属性字段等)
http://localhost:8680/geoserver/urbanlayer/ows?service=wfs&version=1.0.0&request=DescribeFeatureType&typeNames=topp:states
service=wfs # 服务名称值为 WFS
version=1.0.0 # 服务版本值是当前版本号
request=DescribeFeatureType # 表示请求调用的方法
typeNames=topp:states # 请求图层 (typeNames 对于WFS 1.1.0及更早版本)
exceptions # 报告异常的格式默认值为 application/vnd.ogc.se_xml
outputFormat # 返回要素的属性数据类型,常用类型text/xml、text/html、text/plain、application/json
  • GetCapabilities:获取服务能力
http://localhost:8680/geoserver/wfs?service=wfs&version=1.1.0&request=GetCapabilities
ows:OperationsMetadata # 服务所支持的WFS操作
FeatureTypeList # 服务所支持的要素服务列表
ogc:Filter_Capabilities # 服务所支持的过滤操作
  • Transaction:编辑要素
<!--添加要素-->
<wfs:Transaction service="WFS" version="1.0.0"   
   outputFormat="GML2"   
   xmlns:opengis="http://www.cetusOpengis.com"  
   xmlns:wfs="http://www.opengis.net/wfs"  
   xmlns:ogc="http://www.opengis.net/ogc"  
   xmlns:gml="http://www.opengis.net/gml"  
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
   xsi:schemaLocation="http://www.opengis.net/wfs
   http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
   
   <wfs:Insert handle="someprj1">
	  <opengis:someprj>
		 <opengis:the_geom>
			<gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#3395" >
			   <gml:coordinates decimal="." cs="," ts="">1340.212,385.781</gml:coordinates> 
			</gml:Point>
		 </opengis:the_geom>
		 <opengis:ssds>13</opengis:ssds>
		 <opengis:qqybh>12</opengis:qqybh>
		 <opengis:status>0</opengis:status>
	  </opengis:someprj>
   </wfs:Insert>   
</wfs:Transaction>

<!--修改要素-->
<wfs:Transaction service="WFS" version="1.0.0"   
   outputFormat="GML2"   
   xmlns:opengis="http://www.cetusOpengis.com"  
   xmlns:wfs="http://www.opengis.net/wfs"  
   xmlns:ogc="http://www.opengis.net/ogc"  
   xmlns:gml="http://www.opengis.net/gml"  
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
   xsi:schemaLocation="http://www.opengis.net/wfs
   http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
   
   <wfs:Update typeName="opengis:qqyproject"> 
     <wfs:Property>  
       <wfs:Name>qqybh</wfs:Name>
       <wfs:Value>12</wfs:Value>
     </wfs:Property>
     <ogc:Filter>    
		  <ogc:PropertyIsEqualTo>
			  <ogc:PropertyName>qqybh</ogc:PropertyName>
			  <ogc:Literal>0</ogc:Literal>
		  </ogc:PropertyIsEqualTo> 
      </ogc:Filter>    
   </wfs:Update>    
</wfs:Transaction>

<!--删除要素-->
<wfs:Transaction service="WFS" version="1.0.0"   
       outputFormat="GML2"   
       xmlns:opengis="http://www.cetusOpengis.com"  
       xmlns:wfs="http://www.opengis.net/wfs"  
       xmlns:ogc="http://www.opengis.net/ogc"  
       xmlns:gml="http://www.opengis.net/gml"  
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
       xsi:schemaLocation="http://www.opengis.net/wfs
	   http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd">
	   
       <wfs:Delete typeName="opengis:qqyproject"> 
		  <ogc:Filter>    
			  <ogc:PropertyIsLessThan>
				  <ogc:PropertyName>qqybh</ogc:PropertyName>
				  <ogc:Literal>12</ogc:Literal>
			  </ogc:PropertyIsLessThan> 
			  <ogc:PropertyIsGreaterThan>
				  <ogc:PropertyName>qqybh</ogc:PropertyName>
				  <ogc:Literal>0</ogc:Literal>
			  </ogc:PropertyIsGreaterThan> 
		 </ogc:Filter>    
       </wfs:Delete>    
</wfs:Transaction>

# WMTS服务

网络地图切片服务

# 发布WMTS服务

WMTS是在已经发布好WMS服务的基础上进行的,矢量切片只能用于渲染,虽然是矢量格式,但不可编辑

  • 安装矢量切片插件,Vector Tiles (opens new window)
  • 将下载的四个jar包复制到GeoServer的\webapps\geoserver\WEB-INF\lib文件夹下
  • 重启geoserver后,在图层的"Tile Caching",勾选
application/json;type=geojson
application/json;type=topojson
application/json;type=utfgrid
application/vnd.mapbox-vector-tile
  • 点击 "切片图层",预览,再点击 "Seed/Truncate",制作本地切片缓存,加快访问速度
  • 设置切片策略等参数,最后提交,等待切片任务完成

设置切片策略等参数

  • 可以在存放数据的目录(安装时设置)看到切片文件:data/gwc
  • 点击 "geoWebCache" 图标,查看WMTS访问说明文档

# 服务方法介绍

  • GetTile:获取一张瓦片
http://localhost:8080/geoserver/utum/gwc/service/wmts?layer=utum:420000&style=&tilematrixset=EPSG:4326&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/png&TileMatrix=EPSG:4326:10&TileCol=210&TileRow=42
service=WMTS # 表示请求地图切片
version=1.0.0 # 请求的 WMTS 版本
request=GetTile # 表示请求调用的方法,这里为 GetTile
tilematrixset=EPSG:4326 # 指定使用的瓦片矩阵集。瓦片矩阵集定义了地图切片的各个级别和分辨率
layers=topp:states # 表示请求的图层标示
style=point # 表示请求图层渲染需要用到的样式。 style 为空表示使用默认的样式
TileMatrix=EPSG:4326:10 # 指定请求的瓦片矩阵级别
TileCol=210 # 指定请求的切片列号
TileRow=42 # 指定请求的切片行号
format=image/png # 指定请求的图块格式,常见的格式有PNG、JPEG等

# WPS服务

# 安装WPS扩展

# WPS服务说明

  • Execute :允许客户端使用WPS提供的输入参数值并返回生成的输出
http://localhost:8081/geoserver/ows?service=WPS&version=1.0.0&request=Execute&identifier=JTS:buffer&datainputs=geom=point(0%200)@mimetype=application/wkt;distance=10;quadrantSegments=1;capStyle=Square
service=WPS # 服务类型
Request=Execute # 操作名称
version=1.0.0 # 操作的版本,不能为空
Identifier=JTS:buffer # Process流程的标识
language=en-US # 语言标识
DataInputs # 执行Process需要的输入参数
ResponseDocument # 结果的响应格式,为空时请求默认响应的是ExecuteResponseXML文档
  • DescribeProcess :允许客户端请求并接收运行流程的详细信息
http://localhost:8080/geoserver/wps?service=WPS&Request=DescribeProcess&version=1.0.0&language=en-US&Identifier=JTS:centroid,JTS:buffer
service=WPS # 服务类型
Request=DescribeProcess # 操作名称
version=1.0.0 # 操作的版本,不能为空
language=en-US # 语言标识
Identifier=JTS:centroid,JTS:buffer # Process流程的标识,多个Process流程用,号隔开

# 响应结果
ProcessDescription # 流程的完整信息的描述
# 包含流程标识Identifier、输入参数类型DataInputs、输出参数ProcessOutputs以及数据格式类型和约束等
ComplexData # 复合数据类型,表示该数据是Supported标签内支持的数据类型中的组合
LiteralData # 文字数据,可以是任何文本字符串。用于传递单个参数,如数字和文本参数
  • GetCapabilities:获取服务能力
http://localhost:8080/geoserver/wps?service=WPS&Request=GetCapabilities&AcceptVersions=1.0.0
Service Identification # 关于服务的元数据,服务类型和版本
OperationsMetadata # 关于服务支持的由服务器端实现的操作的元数据信息,包括用于操作请求的url
ProcessOfferings # 提供服务器端已经实现了的Process进程的简要描述的无序列表

# 在前端调用

this.$axios({
    method: "get",
    url: "http://127.0.0.1:8081/geoserver/ows",
    params: {
        service: "WPS",
        version: "1.0.0",
        request: "Execute",
        identifier: "JTS:buffer",
		// ResponseDocument: "BufferedPolygon",
        datainputs:
          "geom=point(0 0)@mimetype=application/wkt;distance=10;quadrantSegments=1;capStyle=Square"
    },
}).then(function (response) {
    const x2js = new X2JS();
    const jsonObj = x2js.xml2js(response.data);
    console.info(jsonObj);
    // console.info(response.data.json());
});

# GeoServer提供的Process

GeoServer根据主题将过程分为几个不同的类别。这些类别按前缀分组:

geo # 用于处理二维几何拓扑关系
ras # 对栅格数据进行的各种操作和处理
vec # 对矢量数据进行的各种操作和处理
gs # 专门为GeoServer创建的,比如边界和重投影。它们使用到WFS/WCS的内部连接来读写数据

# 查询过滤

在 Geoserver 中可通过 FEATUREID/CQL_FILTER 对要素进行过滤

  • FEATUREID是根据要素ID过滤
  • CQL_FILTER既支持属性过滤也支持空间过滤

可使用的场景:

  • WMS的GetMap请求中通过filter参数选择在地图上展示的要素
  • WFS的GetFeature请求中通过filter参数过滤返回特定条件的要素
  • SLD样式文件中通过Filter元素根据不同的条件设置不同的样式

# ID过滤

# FeatureID是数据的唯一标识
featureid=map_pts.291393

# 属性过滤

# 等于 = 和不等于 <>
num = 110
num <> 110
num > 290
num <= 290
name = '阳光民族幼儿园'
name <> '阳光民族幼儿园'

# BETWEEN AND值域区间
num BETWEEN 100 AND 150

# LIKE值匹配
name LIKE '%艺术%'

# IN条件
num in (110, 120)
name in ('阳光民族幼儿园', '起点幼儿园')

# IS NULL
name IS NULL

# NOT取反
name IS NOT NULL
name NOT LIKE '%艺术%'
num NOT BETWEEN 100 AND 110
name NOT in ('阳光民族幼儿园', '起点幼儿园')

# 时间过滤
BEFORE # 如time BEFORE '2024-03-31' 表示过滤时间在2024-03-31之前的要素
DURING # 如time DURING 2024-01-01T00:00:00/2024-12-31T23:59:59 过滤时间在一个时间段内的要素
AFTER  # 如time AFTER '2024-03-31' 表示过滤时间在2024-03-31之后的要素

# AND和OR
name like '%阳光%' and num > 100

# 空间过滤

INTERSECTS(Expression, Expression) 
# 相交判断,如intersects(the_geom, POLYGON((106.550313 33.693963,111.906007 33.563336)))

DISJOINT(Expression, Expression)
# 相离判断,其结果与INTERSECTS相反
# 如DISJOINT(the_geom, POLYGON((106.550313 33.693963,111.906007 33.563336))

CONTAINS(Expression, Expression)
# 包含判断,CONTAINS(a, b)表示a包含b,使用使需要注意参数的顺序

WITHIN(Expression, Expression)
# WITHIN(a, b)表示a在b里面,使用使需要注意参数的顺序
# 如WITHIN(the_geom, POLYGON((106.550313 33.693963,111.906007 33.563336))

DWITHIN(Expression, Expression, distance, units)
# DWITHIN(the_geom, POLYGON((106.550313 33.693963,111.906007 33.563336)), 3, meters)
# 表示先将b向外扩3m再做判断,单位可为feet, meters, statute miles, nautical miles, kilometers

BEYOND(Expression, Expression, distance, units)
# 语法上跟DWITHIN一样,结果上刚好相反
# 如BEYOND(the_geom, POLYGON((106.550313 33.693963,111.906007 33.563336)), 3, meters)

BBOX(Expression, Number, Number, Number, Number , [ CRS ])
# 通过四至进行过滤,其中CRS为非必填参数,如bbox(the_geom, 106.55,28.86, 111.90,33.69)

OUCHES(Expression, Expression)
# 边界相交,在边界处至少有一个点相交,但是在内部不相交

CROSSES(Expression, Expression)
# 交叉判断,多为线要素和其他要素的判断

OVERLAPS(Expression, Expression)
# 判断同一类型的要素是否有重叠

RELATE(Expression, Expression, pattern)
# 相关联

注意

在使用空间过滤时,第一个参数Expression 必须是the_geom,第二个参数是WKT

# 图层样式

# 常用图层样式

  • 点聚合样式SLD
<?xml version="1.0" encoding="gb2312"?>
<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">#FF0000</CssParameter>
                  <CssParameter name="fill-opacity">0.5</CssParameter>
                </Fill>
              </Mark>
              <Size>25</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>
  • 热力图样式SLD
<?xml version="1.0" encoding="gb2312"?>
<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>Heatmap</Name>
   <UserStyle>
	 <Title>Heatmap</Title>
	 <Abstract>A heatmap surface showing population density</Abstract>
	 <FeatureTypeStyle>
	   <Transformation>
		 <ogc:Function name="gs:Heatmap">
		   <ogc:Function name="parameter">
			 <ogc:Literal>data</ogc:Literal>
		   </ogc:Function>
		   <ogc:Function name="parameter">
			 <ogc:Literal>weightAttr</ogc:Literal>
			 <!--指定权重字段,在这里我设置权重字段名称为jan_je-->
			 <ogc:Literal>jan_je</ogc:Literal>
		   </ogc:Function>
		   <ogc:Function name="parameter">
			 <ogc:Literal>radiusPixels</ogc:Literal>
			 <ogc:Function name="env">
			   <ogc:Literal>radius</ogc:Literal>
			   <ogc:Literal>100</ogc:Literal>
			 </ogc:Function>
		   </ogc:Function>
		   <ogc:Function name="parameter">
			 <ogc:Literal>pixelsPerCell</ogc:Literal>
			 <ogc:Literal>10</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>
		<RasterSymbolizer>
		  <Geometry>
			<ogc:PropertyName>geom</ogc:PropertyName></Geometry>
		  <Opacity>0.6</Opacity>
			<ColorMap type="ramp" >
			<ColorMapEntry color="#0000FF" quantity="0" label="nodata" opacity="0"/>
			<ColorMapEntry color="#00FFFF" quantity="0.02" label="nodata"
			  opacity="0"/>
			<ColorMapEntry color="#00FF00" quantity=".1" label="nodata"/>
			<ColorMapEntry color="#FFFF00" quantity=".5" label="values" />
			<ColorMapEntry color="#FF0000" quantity="1.0" label="values" />
		  </ColorMap>
		</RasterSymbolizer>
	   </Rule>
	 </FeatureTypeStyle>
   </UserStyle>
 </NamedLayer>
</StyledLayerDescriptor>
  • 格网统计样式SLD
<?xml version="1.0" encoding="gb2312"?>
<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>20</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>
          <Name>rule1</Name>
          <Title>大于2000</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsGreaterThan>
              <ogc:PropertyName>count</ogc:PropertyName> <!-- 属性字段名 -->
              <ogc:Literal>2000</ogc:Literal><!-- 属性值 -->
            </ogc:PropertyIsGreaterThan>
          </ogc:Filter>
          <PointSymbolizer> <!-- 点标记器 -->
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#FF0000</CssParameter><!-- 此点配置的颜色 -->
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>

        <Rule>
          <Name>rule2</Name>
          <Title>大于1000小于2000</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>1000</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>2000</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#AC00BB</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>

        <Rule>
          <Name>rule3</Name>
          <Title>大于500小于1000</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>500</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>1000</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#3900BB</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>
        <Rule>
          <Name>rule4</Name>
          <Title>大于200小于500</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>200</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>500</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#C08904</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>
        <Rule>
          <Name>rule4</Name>
          <Title>大于100小于200</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>100</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>200</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#C0BE04</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>
        <Rule>
          <Name>rule5</Name>
          <Title>大于50小于100</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsBetween><!-- value值大于100,小于200 -->
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>50</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>100</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#04C053</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>
        <Rule>
          <Name>rule6</Name>
          <Title>大于0小于50</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsBetween>
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:LowerBoundary>
                <ogc:Literal>0</ogc:Literal>
              </ogc:LowerBoundary>
              <ogc:UpperBoundary>
                <ogc:Literal>50</ogc:Literal>
              </ogc:UpperBoundary>
            </ogc:PropertyIsBetween>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#0096BB</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>
        <Rule>
          <Name>rule8</Name>
          <Title>等于0</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsEqualTo>
              <ogc:PropertyName>count</ogc:PropertyName>
              <ogc:Literal>0</ogc:Literal>
            </ogc:PropertyIsEqualTo>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#6EC004</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
        <Rule>
          <Name>rule1</Name>
          <Title>等于null</Title>
          <Abstract>A 6 pixel square with a red fill and no stroke</Abstract>
          <ogc:Filter>
            <ogc:PropertyIsNull>
              <ogc:PropertyName>count</ogc:PropertyName>
            </ogc:PropertyIsNull>
          </ogc:Filter>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>square</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#6EC004</CssParameter>
                </Fill>
              </Mark>
              <Size>20</Size>
            </Graphic>
          </PointSymbolizer>
          <TextSymbolizer>
            <Label>
              <ogc:PropertyName>count</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>