diff --git a/public/app/plugins/panel/geomap/style/markers.ts b/public/app/plugins/panel/geomap/style/markers.ts index a643ab97bc8..3accfd7f82d 100644 --- a/public/app/plugins/panel/geomap/style/markers.ts +++ b/public/app/plugins/panel/geomap/style/markers.ts @@ -216,7 +216,7 @@ const makers: SymbolMaker[] = [ }, ]; -async function prepareSVG(url: string): Promise { +async function prepareSVG(url: string, size?: number): Promise { return fetch(url, { method: 'GET' }) .then((res) => { return res.text(); @@ -228,8 +228,15 @@ async function prepareSVG(url: string): Promise { if (!svg) { return ''; } + + const svgSize = size ?? 100; + const width = svg.getAttribute('width') ?? svgSize; + const height = svg.getAttribute('height') ?? svgSize; + // open layers requires a white fill becaues it uses tint to set color svg.setAttribute('fill', '#fff'); + svg.setAttribute('width', `${width}px`); + svg.setAttribute('height', `${height}px`); const svgString = new XMLSerializer().serializeToString(svg); const svgURI = encodeURIComponent(svgString); return `data:image/svg+xml,${svgURI}`;