my test code
const layer =
new IconLayer({
id: 'icon-layer',
data,
getIcon: d=> ({data : 'data/test.svg', width:128, height:128}),
getSize: d => Math.max(2, Math.min(d.contributions / 1000 * 25, 25)),
pickable: true,
sizeScale: 15,
getPosition: d => [127.14467,31.39953]
});
I got a error.
icon-manager.js:366 DOMException: The source image cannot be decoded.
how to Using svg in iconlayer of deck.gl?
According to the API reference the returned object of the getIcon
callback must contain a url
property. From the documentation:
getIcon: d => ({
url: d.avatar_url,
width: 128,
height: 128,
anchorY: 128
}),
In your example you need to rename the url
property to data
.