I have displayed multiple tile layers in OpenLayers. Now I want to display layers name in the browser console on every zoom level.
This is my code:
var layers = [
new ol.layer.Tile({
source: new ol.source.OSM(),
name: "osm",
}),
new ol.layer.Tile({
// extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.TileWMS({
url: "http://localhost:8080/geoserver/cite/wms",
params: { LAYERS: "cite:india1", TILED: true },
serverType: "geoserver",
transition: 0,
crossOrigin: "anonymous",
}),
}),
new ol.layer.Tile({
// extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.TileWMS({
url: "http://localhost:8080/geoserver/cite/wms",
// params: {'LAYERS': 'cite:india1,cite:india2,cite:india3,cite:india4,cite:india5,cite:india6,cite:india7,cite:india8,cite:india9,cite:india10,cite:india11,cite:india12,cite:india13,cite:india14,cite:india15,cite:india16', 'TILED': true},
params: { LAYERS: "cite:india16", TILED: true },
serverType: "geoserver",
transition: 0,
crossOrigin: "anonymous",
}),
}),
new ol.layer.Tile({
// extent: [-13884991, 2870341, -7455066, 6338219],
source: new ol.source.TileWMS({
url: "http://localhost:8080/geoserver/cite/wms",
// params: {'LAYERS': 'cite:india1,cite:india2,cite:india3,cite:india4,cite:india5,cite:india6,cite:india7,cite:india8,cite:india9,cite:india10,cite:india11,cite:india12,cite:india13,cite:india14,cite:india15,cite:india16', 'TILED': true},
params: { LAYERS: "cite:india15", TILED: true },
serverType: "geoserver",
transition: 0,
crossOrigin: "anonymous",
}),
}),
];
var map = new ol.Map({
layers: layers,
target: "map",
view: new ol.View({
center: [-85.685, 39.891],
// -85.685, 39.891
// -10997148, 4569099
zoom: 3,
}),
});