首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Geoserver & Leaflet GetFeatureInfo

Geoserver & Leaflet GetFeatureInfo
EN

Stack Overflow用户
提问于 2020-05-26 00:35:11
回答 1查看 401关注 0票数 0

我想禁用叶页的WMS getFeatureInfo弹出窗口,当我在wms图层enter image description here之外单击时,我使用此插件https://gist.github.com/rclark/6908938

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-05-26 00:42:13

将函数更改为:

代码语言:javascript
复制
 getFeatureInfo: function (evt) {
    // Make an AJAX request to the server and hope for the best
    var url = this.getFeatureInfoUrl(evt.latlng),
      showResults = L.Util.bind(this.showGetFeatureInfo, this);
    $.ajax({
      url: url,
      success: function (data, status, xhr) {
        var err = typeof data === 'string' ? null : data;
        //Fix for blank popup window
        var doc = (new DOMParser()).parseFromString(data, "text/html"); 
        if (doc.body.innerHTML.trim().length > 0)
          showResults(err, evt.latlng, data);
      },
      error: function (xhr, status, error) {
        showResults(error);
      }
    });
  },

来源:https://gist.github.com/rclark/6908938#gistcomment-2277325

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62006783

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档