--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/6b53737d-7662-4146-b5cc-3b98bb0c2c22%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
esriPlugin <- htmlDependencies('leaflet.esri',
src = '/leaflet.esri/1.0.3/',
script = 'esri-leaflet.js'
)
registerPlugin <- function(map, plugin){
map$dependencies <- c(map$dependencies, list(plugin))
map
}
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/490948d0-e2ff-4c16-b53f-f5e04a8155e3%40googlegroups.com.
LeafletSideBySidePlugin <- htmlDependency("leaflet-side-by-side","2.0.0", src = c(href="https://github.com/digidem/leaflet-side-by-side"), script="leaflet-side-by-side.js")
# A function that takes a plugin htmlDependency object and adds# it to the map. This ensures that however or whenever the map# gets rendered, the plugin will be loaded into the browser.
registerPlugin <- function(map, plugin) { map$dependencies <- c(map$dependencies, list(plugin)) map}
leaflet() %>% addTiles() %>% setView(lng = 12, lat = 50, zoom = 4) %>% # Register leaflet-side-by-side plugin on this map instance registerPlugin(LeafletSideBySidePlugin) %>% onRender(" function(el, x) {var mylayer1 = L.tileLayer( 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',{ maxZoom: 18 })var mylayer2 = L.tileLayer( '//stamen-tiles-{s}.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.png',{ maxZoom: 14 }) L.control.sideBySide(mylayer1, mylayer2).addTo(this); ")