dsjuimtq920056 2016-12-12 03:11
浏览 191

如何获取由php在geoserver中发布的图层列表?

I'm using Apache Tomcat 7.0.72 & Geoserver v2.2 & php v5.3.5. i'm going to make a server side app with PHP that controls Accessing the layers that are published with Geoserver.In viewing the layers from the Geoserver i'm using Openlayers3.i want to have a list of layers that are published in Geoserver. what should i do??!

  • 写回答

1条回答 默认 最新

  • duancan8382 2016-12-12 08:24
    关注

    Why aren't you just using a WMS GetCapabilities request? OpenLayers has ol.format.WMSCapabilities, so you can easily get a JSON from the available layers.

    var xhr = new XMLHttpRequest();
    xhr.open('GET', '/geoserver/wms?service=wms&request=GetCapabilities');
    xhr.onload = function() {
      var parser = new ol.format.WMSCapabilities();
      var capabilities = parser.read(xhr.responseText);
      var layers = capabilities.Capability.Layer.Layer;
      /* List of layers is now in the `layers` array */
    };
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据