如何从地理服务器获取图层列表

发布于 2024-09-26 07:28:04 字数 61 浏览 2 评论 0原文

是否可以获取 geoserver 服务的所有图层的列表?即是否有一些特定的 url 请求要发送来执行此操作?

Is it possible to get a list of all the layers served by geoserver? I.e. is there some specific url request to send that does this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一场信仰旅途 2024-10-03 07:28:04

geoserver 主页上的功能链接每个都列出通过各种服务提供服务的图层:

  • WMS 功能列出支持切片图像请求的图层
  • WFS 功能列出支持矢量数据请求的图层
  • WCS 功能列出支持栅格查询的图层

示例 WMS请求将如下所示:

http://demo .opengeo.org/geoserver/wms?request=GetCapability&service=WMS&version=1.0.0

The capabilities links on the geoserver home page each list layers served via various services:

  • the WMS capabilities lists layers that support requests for tiled images
  • the WFS capabilities lists layers that support requests for vector data
  • the WCS capabilities lists layers that support raster queries

A sample WMS request would look like this:

http://demo.opengeo.org/geoserver/wms?request=GetCapabilities&service=WMS&version=1.0.0

惜醉颜 2024-10-03 07:28:04

因此,为了完整起见,下面是如何获取图层列表/数组的示例:

        var formatter = new OpenLayers.Format.WMSCapabilities();
        var endpoint = "path/to/wms/endpoint";
        var layers = [];

        // async call to geoserver (I'm using angular)
        $http.get(endpoint + 'request=GetCapabilities').

        success(function(data, status, headers, config) {

            // use the tool to parse the data
            var response = (formatter.read(data));

            // this object contains all the GetCapabilities data
            var capability = response.capability;

            // I want a list of names to use in my queries
            for(var i = 0; i < capability.layers.length; i ++){
                layers.push(capability.layers[i].name);
            }
        }).

        error(function(data, status, headers, config) {
            alert("terrible error logging..");
        });

So just for completeness, here's an example of how to get a list/array of layers:

        var formatter = new OpenLayers.Format.WMSCapabilities();
        var endpoint = "path/to/wms/endpoint";
        var layers = [];

        // async call to geoserver (I'm using angular)
        $http.get(endpoint + 'request=GetCapabilities').

        success(function(data, status, headers, config) {

            // use the tool to parse the data
            var response = (formatter.read(data));

            // this object contains all the GetCapabilities data
            var capability = response.capability;

            // I want a list of names to use in my queries
            for(var i = 0; i < capability.layers.length; i ++){
                layers.push(capability.layers[i].name);
            }
        }).

        error(function(data, status, headers, config) {
            alert("terrible error logging..");
        });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文