I was working on a project using TomTom maps on WebSdk. I am currently using png
image for markers and I was wondering if there is anyway we could use svg
icon in the marker instead of an image?
Asked
Active
Viewed 243 times
0

ascripter
- 5,665
- 12
- 45
- 68

Anshul Walia
- 109
- 1
- 10
1 Answers
1
Try that way:
var svg = '<?xml version="1.0" encoding="UTF-8"?><svg height="100" width="100" xmlns="http://www.w3.org/2000/svg"><circle cx="50" cy="50" r="40" stroke="black" stroke-width="3" fill="red" /></svg>';
var iconUrl = 'data:image/svg+xml;base64,' + btoa(svg);
tomtom.L.marker([51.75939,19.44856], {
icon: tomtom.L.icon({
iconUrl: iconUrl,
iconSize: [30, 34],
iconAnchor: [15, 34]
})
}).addTo(map);

szogoon
- 470
- 3
- 15