r - Get (multiple) custom icons in leaflet from rCharts -
i looking create map using rcharts/leaflet cannot figure out how create custom icons , use them.
here solution, not work: https://github.com/ramnathv/rcharts/issues/301
l1$geojson(togeojson(data_),    pointtolayer =  "#! function(feature, latlng){     return l.marker(latlng, {icon: l.icon.extend({       options: {         shadowurl: 'leaf-shadow.png',         iconsize:     [38, 95],         shadowsize:   [50, 64],         iconanchor:   [22, 94],         shadowanchor: [4, 62],         popupanchor:  [-3, -76]       }})     })   } !#" ) but not work. , iconurl not defined here not changed right? glad have reproducable example.
ps: best case multiple icons. has clue on that?
/edit:
ok figured out. had place *.png files in same folder index.html file located, not project folder. there way include them can use rstudio viewer that?
you can create new icons
var mynewicon = l.icon({     iconurl: 'my-icon.png',     iconretinaurl: 'my-icon@2x.png',     iconsize: [38, 95],     iconanchor: [22, 94],     popupanchor: [-3, -76],     shadowurl: 'my-icon-shadow.png',     shadowretinaurl: 'my-icon-shadow@2x.png',     shadowsize: [68, 95],     shadowanchor: [22, 94] }); then reference  return l.marker(latlng, {icon: mynewicon}).i don't see making new instance of icon in posted code example, you're extending base class. don't think mean extend class in case.
Comments
Post a Comment