Calling getData(evt.pixel) on WMS layer returns null #15744
-
I have a WMS layer on my map and am trying to following this example The 'singleclick' callback function of the example successfully gets the info from my layer Anyone knows why I'm not getting any data from calling getData() function on my WMS layer ? Any help would be appreciated. Here's the definition of my WMS layer I'm using:
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
Beta Was this translation helpful? Give feedback.
-
Ah sorry, I was on the wrong track. My answer above was referring to The problem in your code is that your crossOrigin: 'anonymous', config option. If it still does not work with that setting, then the WMS does not send CORS headers. |
Beta Was this translation helpful? Give feedback.
-
Thanks. It is working now. |
Beta Was this translation helpful? Give feedback.
Ah sorry, I was on the wrong track. My answer above was referring to
getFeature(pixel)
.The problem in your code is that your
TileWMS
source is missing theconfig option. If it still does not work with that setting, then the WMS does not send CORS headers.