I have a map containing two layers and I need to configure a decoration layout to include a scale line and the legend for one of the layers.
However, it seems that GeoServer can't find my layout file. In fact, when I go to the style preview page (on GeoServer), the map area shows nothing but an error message saying Could not find decoration layout named: style-editor-legend
and here's what it looks like:
I have checked my "Data Directory" on the "Server Status" page and it points correctly to where my layout directory is, along with my layout file, so I suppose that's not the issue.
Is there a place where I can inform the layout file to be used? A GeoServer page or a file somewhere?
I do realize I must insert &format_options=layout:style-editor-legend
to the request parameters, but, when I do that, the map that currently works (without the legend and scale line) stops working.
Here is my .js code that currently requests the map (shown after the code).
What am I getting wrong?
var map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
})
],
view: new ol.View({
center: ol.proj.fromLonLat([-55.41, -15.82]),
zoom: 4.5
})
});
var mun_covid19 = new ol.layer.Image({
source: new ol.source.ImageWMS({
url:'http://192.168.3.143:8080/geoserver/Covid19_Workspace/wms',
params:{'layers':'Covid19_Workspace:municipios_covid19'},
serverType: 'geoserver'
})
});
map.addLayer(mun_covid19);
var brasil_estados = new ol.layer.Image({
source: new ol.source.ImageWMS({
url:'http://192.168.3.143:8080/geoserver/Covid19_Workspace/wms',
params:{'layers':'Covid19_Workspace:estados_brasileiros'},
serverType: 'geoserver'
})
});
map.addLayer(brasil_estados);