I'm trying to add multiple layers from a single Geoserver source to my Openlayers map. I can get each layer to appear by changing a single line of code. but when I attempt to have both layers on at once, I get a blank map. How do I add both? One is a raster, the other is a vector.
I've attempted via having the additional layer in a new variable and using map.addlayer. This didn't break the map, but it still didn't load the additional layer. I tried by just adding the additional layer into the layer variable, broke the map. I also tried by adding it to the params. So it was
params:{'LAYERS': 'Test:TestImagery', 'Test:Vector'},
This broke the map. How do I make this work?
Code:
<script>
var layers = [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
new ol.layer.Image({
extent: [-20000000, 1000000, -5000000, 9000000],
source: new ol.source.ImageWMS({
url: 'http://localhost/geoserver/Test/wms',
params: {'LAYERS': 'Test:TestImagery'},
ratio: 1,
serverType: 'geoserver'
})
})
];
var map = new ol.Map({
layers: layers,
target: 'map',
view: new ol.View({
center: [0,0],
zoom: 14
})
});
</script>
params:{'LAYERS': 'Test:TestImagery,Test:Vector'},
Also check what actual http request is made