Closed dwy904 closed 7 years ago
I would really like to do this as well. I've been trying to adapt the code from this gist: https://gist.github.com/jcheng5/c084a59717f18e947a17955007dc5f92
Using this plugin: https://github.com/rubenspgcavalcante/leaflet-ant-path
I haven't had any luck. Nothing is showing up. Then I noticed that the plugin requires Leaflet >= 1. R's version of leaflet is still stuck at 0.7.
Any update on the ant-path feature for the Leaflet package on R ?
I was away from development for a bit. I've resumed development, but my first order of thing is to release this to CRAN as it stands now. After that I'll surely add this after UseR! 2017, so expect some progress in second week of July.
Closing for now. Please reopen when the leaflet R pkg moves to 1.x.
leaflet-ant-path has become an excellent plugin, and I would like to use it in R to replace Leaflet-minicharts (I use addflow to display arrows on polylines). Someone tried with htmlwidgets :: onRender? It would be great if it was included in leaflet-extras.
my solution:
`library(leaflet) library(htmltools) library(htmlwidgets) library(dplyr)
antPlugin <- htmlDependency(name = "leaflet-ant-path", src = "C:\Users\Bruno\Downloads\leaflet-ant-path-bower-master\dist\", version = "1.0.0", script = "leaflet-ant-path.js")
registerPlugin <- function(map, plugin) { map$dependencies <- c(map$dependencies, list(plugin)) map }
data <- tibble( lng = c(-3.6720452, -3.7482748), lat = c(-39.115116, -38.46086) )
leaflet() %>% addTiles() %>% setView(-38.75, -3.75, zoom = 10) %>% registerPlugin(antPlugin) %>% onRender(" function(el, x, data) { antPolyline = L.polyline.antPath( [ [data.lng[0], data.lat[0]], [data.lng[1], data.lat[1]] ], { delay: 800, dashArray: [20, 100], weight: 6, color: '#FF0000', hardwareAccelerated: true } ); antPolyline.addTo(this); } ", data = data) `
An Ant-Path feature is highly desirable. I love to draw moving lines to visualize flight routes. I really hope you could add this feature.