0 安装WPS扩展
- 链接:wps扩展下载官方下载地址
- 解压扩展包,将解压文件夹内的jar包全部copy进geoserver WEB-INF/lib文件夹内
- 重启geoserver服务即可
1 geoserver管理界面关于wps服务的界面
服务管理界面、处理历史界面、WPS request builder界面(具体略......)
2 WPS服务说明
-
GetCapabilities:请求提供服务的详细信息,包括服务元数据和描述可用流程的元数据。响应是一个称为功能文档的 XML 文档。
//service:服务;version:版本;request:请求;
http://localhost:8080/geoserver/ows?
service=WPS&
version=1.0.0&
request=GetCapabilities
-
DescribeProcess:请求描述通过服务可用的 WPS 进程。
//service:服务;version:版本;request:请求;identifier:操作标识
http://localhost:8080/geoserver/ows?
service=WPS&
version=1.0.0&
request=DescribeProcess&
identifier=JTS:buffer
-
Execute:执行服务(以缓冲区分析为例,datainputs为缓冲区操作的输入参数,其格式规则是重点,详情见 OGC Web Processing Service 05-007r7,很重要)
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
3 Vue中开发调用
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",
datainputs:
"geom=point(0 0)@mimetype=application/wkt;distance=10;quadrantSegments=1;capStyle=Square",
// ResponseDocument: "BufferedPolygon",
},
}).then(function (response) {
const x2js = new X2JS();
const jsonObj = x2js.xml2js(response.data);
console.info(jsonObj);
// console.info(response.data.json());
});
结果: