Leaflet SVG icon from JavaScript with image -


it's possible create leaflet icon svg:

var icon = "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10' height='10'><path stroke='red' stroke-width='2' fill='none' d='m 0,0 l 10,10 m 10,0 l 0,10 z'/></svg>"; var svgurl = "data:image/svg+xml;base64," + btoa(icon); var mysvgicon = l.icon({ iconurl: svgurl }); 

but when trying add image svg (with absolute url, seems doesn't working relative url either) this:

var icon = "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10' height='10'><img src='http://www.gravatar.com/avatar/abc'/></svg>"; 

the image not dispayed.

update:

not working valid svg attributes, too:

var icon = "<svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='10' height='10'><image xlink:href='http://www.gravatar.com/avatar/abc'/></svg>"; 


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -