WMS Layer / GetFeatureInfo

550
0
03-28-2022 12:58 PM
kevmahone
New Contributor

I have added a WMSLayer and when I click on a feature it is properly displayed in the default popup. However,  I need to manually call the GetFeatureInfo method on the service (code below) but the bounding box used to call the GetMap method by ESRI does not match the mapviews extent (everything but the ymax matches) so when I manually call the GetFeatureInfo I do not get any features returned. If I manually modify the ymax value to match what ESRI uses in the call to GetMap the feature is returned. How do I get the bounding box that ESRI uses to request images from a WMSLayer via the GetMap call if it is not the mapview's extent?? 

 

var extent = app.mapView.extent;
var screenPoint = app.mapView.toScreen(mapPoint);

var urlGet = layer.featureInfoUrl;

var data = {
bbox: extent.xmin.toString() + "," + extent.ymin.toString() + "," + extent.xmax.toString() + "," + extent.ymax.toString(),
crs: 'EPSG:3857',
format: 'text/xml',
request: 'GetFeatureInfo',
service: 'WMS',
styles: '',
transparent: 'true',
version: '1.3.0',
layers: "##########",
query_layers: "######",
info_format: 'text/javascript',
feature_count: 25,
format_options: 'callback:getJson',
width: app.mapView.width.toString(),
height: app.mapView.height.toString(),
I: parseInt(screenPoint.x).toString(),
J: parseInt(screenPoint.y).toString()
};
$.ajax({
type: 'GET',
url: urlGet,
data: data,
dataType: "jsonp",
jsonpCallback: 'getJson',
success: handleJson,
error: function (jqXHR, textStatus, errorThrown) {
logMessage("E", "error in GetFeatureInfo AJAX call ->" + textStatus + "\n" + errorThrown, "GisExtra/wmsQuery");
}
});

Tags (2)
0 Kudos
0 Replies