地理服务器和传单 GetFeatureInfo
Geoserver & Leaflet GetFeatureInfo
我想在单击 wms 层外时禁用 Leaflet 的 WMS getFeatureInfo 弹出窗口enter image description here I use this plugin https://gist.github.com/rclark/6908938
将您的函数更改为:
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
我想在单击 wms 层外时禁用 Leaflet 的 WMS getFeatureInfo 弹出窗口enter image description here I use this plugin https://gist.github.com/rclark/6908938
将您的函数更改为:
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