I am trying to access the value of a pixel served through MapServer from webapp via OpenLayers getFeatureInfoUrl(). The server responds with msWMSFeatureInfo(): WMS server error. Invalid I/J values I have tried googling it but could not find any clues on what might be wring with my request only that I/J values refer to the coorndinates of the mouse click so the problem might originate in evt.coordinate from:
var vs = this.wmsLayer
mapol.on('singleclick', function(evt) {
document.getElementById('info').innerHTML = '';
var viewResolution = /** @type {number} */ (view.getResolution());
var url = vs.getSource().getGetFeatureInfoUrl(
evt.coordinate, viewResolution, 'EPSG:4326',
{'INFO_FORMAT': 'text/html'});
if (url) {
document.getElementById('info').innerHTML =
'<iframe seamless src="' + url + '"></iframe>';
}
});
The wmsLayer uses the same 'EPSG:4326' coordinate system as request. Can anyone help me get the pixel value at the clicked location:)
The SRS of the coordinate you pass to the
#getGetFeatureInfoUrl()
method needs to match the projection you provide as argument. So you'd have to change your code to