0 安装CSW扩展
- 链接:官方下载地址
- 解压扩展包,将解压文件夹内的jar包全部copy进geoserver WEB-INF/lib文件夹内
- 重启geoserver服务即可
1 CSW服务管理界面
2 CSW服务操作说明
-
GetCapabilities:允许CSW客户端检索服务端的元数据。对GetCapabilities请求的响应为包含关于服务器的服务元数据的XML文档;
//service:服务类型;version:版本;request:请求类型;
http://localhost:8081/geoserver/ows?
service=CSW&
version=2.0.2&
request=GetCapabilities
-
GetRecords:查询服务器上的服务记录,以XM形式返回服务器上所有服务记录条目;
http://localhost:8081/geoserver/ows?
service=CSW&
version=2.0.2&
request=GetRecords&
resultType=results&
typeNames=csw:Record&
maxRecords=100
-
GetRecordById:根据Id查询服务器上的指定的服务记录;
http://localhost:8081/geoserver/ows?service=CSW&
version=2.0.2&
request=GetRecordById&
resultType=results&
ElementSetName=full&
Id=XXX
-
GetDomain:用于获取关于元数据记录元素或请求参数的值范围的运行时信息;
-
DescribeRecord:允许客户端发现目标目录服务所支持的信息模型的元素。该操作允许描述部分或全部的信息模型;
3 Vue中开发调用
this.$axios({
method: "get",
url: "http://127.0.0.1:8081/geoserver/ows",
params: {
service: "CSW",
version: "2.0.2",
request: "GetRecords",
resultType: 'results',
typeNames: 'csw:Record',
maxRecords: 100
},
}).then(function (response) {
const x2js = new X2JS();
const jsonObj = x2js.xml2js(response.data);
console.info(jsonObj);
});