'Openlayers - ol-ext: print dialog - add simple image to pop-up Legend
I am using this plugin https://viglino.github.io/ol-ext/examples/canvas/map.control.printdialog.html to generate well formatted print in openlayers.
I would like to modify canvas.ol-legendImg by insert only one item as an image .png in the pop-up legend and not a legend made up of Style and Icon.
How can I do?
Report the original code:
// Legend
var legend = new ol.legend.Legend({
title: 'Legend',
margin: 5,
items: [{
title: 'Church',
typeGeom: 'Point',
style: new ol.style.Style({
image: new ol.style.Icon({
src: 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Eglise_icone_2.svg/30px-Eglise_icone_2.svg.png',
crossOrigin: 'anonymous' // Enable print
})})
}, {
title: 'Photo',
typeGeom: 'Point',
style: new ol.style.Style({
image: new ol.style.Icon({
src: 'https://upload.wikimedia.org/wikipedia/commons/thumb/d/d4/Icone_appareil_photo.svg/30px-Icone_appareil_photo.svg.png',
crossOrigin: 'anonymous' // Enable print
})})
}, {
title: 'Line', typeGeom: 'LineString', style: ol.style.Style.defaultStyle()
}, {
title: 'Polygon', typeGeom: 'Polygon', style: ol.style.Style.defaultStyle()
}]
});
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
