Icon Definition Sans URL

15 views
Skip to first unread message

Arnie Shore

unread,
Nov 13, 2015, 11:10:15 AM11/13/15
to leafl...@googlegroups.com
Per the docs, defining an icon requires its url, like:
  var myIcon = L.icon({iconUrl: 'my-icon.png', ... .
But sans any library, what is the syntax for an icon consisting of an svg vector definition, given that
definition existing in a string I'm generating dynamically. Thanks for any help on this.



Arnie Shore

unread,
Nov 13, 2015, 12:19:03 PM11/13/15
to leafl...@googlegroups.com
Answering my own question after my morning caffeine injection, I now see that the url is simply - HAH! - the address of my generating function.

Modulo some testing, of course.  So pls do share any insights or url's.

ghybs

unread,
Nov 14, 2015, 10:53:14 AM11/14/15
to Leaflet
Hi,

In case your previous plan did not work, you would probably be interested in how that plugin works:
Leaflet.vector-markers
https://github.com/hiasinho/Leaflet.vector-markers

At first sight, it seems to mainly create the equivalent of an L.DivIcon, and to set its html to an SVG tag.

Hope this helps.
Reply all
Reply to author
Forward
0 new messages