In my application i am using a wmsLayer. In order to make a proper getFeatureInfo-request i need to specify the appropriate map-pixel values. How can i obtain them?
I am able to get the screen-pixels on click, but i fail to transform them to map-pixels.
I tried using the view.toMap({x,y})
function but the retrieved values are Webmercator-coordinates and no pixel-coordinates.
There is maybe something more general that i am missing, so i would appreciate any kind of guidance through this task!
The click
events of the view, gives you the screen pixels relative to the view on the x
and y
properties, besides de map coordinates.
That should be the one you are looking for to build the request. Remember that the request includes the bounding box, wich together with the pixel size and the screen pixel is utilized to calculate the required map coordinates for the query.
In case you have a map point coordinate and want the screen pixel, the view has another method toScreen
that given the map point returns the correspondant screen pixel relative to the top left corner of the VIEW.