【问题标题】:Geoserver & Leaflet GetFeatureInfo地理服务器和传单 GetFeatureInfo
【发布时间】:2020-05-25 16:35:11
【问题描述】:

当我在wms层外点击时,我想禁用Leaflet的WMS getFeatureInfo弹出窗口enter image description here我使用这个插件https://gist.github.com/rclark/6908938

【问题讨论】:

    标签: javascript leaflet geoserver wms


    【解决方案1】:

    将您的功能更改为:

     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

    【讨论】:

    • 这正是我想要的感谢您的快速回复
    猜你喜欢
    • 1970-01-01
    • 2020-04-15
    • 2013-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-08-24
    • 2011-08-19
    • 2014-08-27
    相关资源
    最近更新 更多