I am using OpenLayers 4 to building my app. Although I have successfully created an app which only one layers identify as per this tutorial
I then edited the code to ideally get attribute information for multiple layers using the following code
map.on('click', function (evt) {
var url = LAYERS.getSource().getGetFeatureInfoUrl
evt.coordinate, viewResolution, viewProjection,
'INFO_FORMAT': 'text/html',
'QUERY_LAYERS': 'County:Boundary,County:Regions,County:Constituency,County:Towns'
if (url) {
document.getElementById('info').innerHTML =
content.innerHTML = '<iframe seamless src="' + url + '"></iframe>';
}
});
map.on('pointermove', function(evt) {
if (evt.dragging) {
return;
}
var pixel = map.getEventPixel(evt.originalEvent);
var hit = map.forEachLayerAtPixel(pixel, function() {
return true;
});
map.getTargetElement().style.cursor = hit ? 'pointer' : '';
});
Then I get the error ReferenceError: LAYERS is not defined
The application is complaining about the ol.js
Can someone please advise on how to go about resolving this error?
Many thanks & regards
Amelia