I have a leaflet map that shows a couple of geojson layers. The style for each layer is represented in a TOC by means of the plugin Grouped Layer Control. The TOC has the following aspect:
The question is if there are tools to generate the icons of the layers for the TOC more or less automatically from leaflet styles like these ones:
function styleMessalo_T100(feature) {
return {
weight: 0.52,
color: '#000000',
fillColor: '#3da06d',
opacity: 0,
fillOpacity: 0.3
};
};
function styleEstradas(feature) {
var highway = feature.properties.tags.highway;
if ( highway && ((highway === 'primary') || (highway === secondary'))) {
return {
weight: 0.6,
color: '#9c0000',
opacity: 1
}
} else {
return {
weight: 0.6,
color: '#6d7672',
opacity: 1
}
}
};
var iconBarragem = L.icon({
iconUrl: '../markers/barragem.jpg',
iconSize: [20.0, 20.0],
});
function doPointToLayerBarragem4(feature, latlng) {
return L.marker(latlng, return {
icon: iconBarragem,
});
}
Now, I'm creating similar styles manually in qgis, and using qgis2web plugin to generate a webmap. Then I take the png files from the legend folder, rename it, and paste it into my own project.
To clarify. I'm aware that I can create a more or less pure html+css legend pretty similar to the desired styles, coding it by hand as exposed in this or this or this answers.
But I'm looking for a gui tool or script (preferable for automatizing the process) that given a leaflet style or something like mapbox-simplestyle generates an image file or html+css code that represents the legend.
I also see a suggestion to use geoserver but this seems overkilling.