ramnathv / rMaps

Interactive Maps from R
http://rmaps.github.io
389 stars 194 forks source link

Not displaying route using rMaps and leaflet routing machine plugin #91

Open aruizga7 opened 9 years ago

aruizga7 commented 9 years ago

Hi there,

I am following this example:

https://gist.github.com/ramnathv/9998388

My goal is to plot a route. Using RStudio it is working properly but when I want to use it in Shiny it is only plotting the map but not the route. Anyone has a solution for this? Also if I run the script in the R console, it is not working neither...only works in RStudio.

THanks!

library(rMaps)

library(rCharts)

map = Leaflet$new() map$setView(c(40.74119, -73.9925), 13) map$tileLayer(provider = 'Stamen.TonerLite')

mywaypoints = list(c(40.74119, -73.9925), c(40.73573, -73.99302))

map$addAssets( css = "http://www.liedman.net/leaflet-routing-machine/dist/leaflet-routing-machine.css", jshead = "http://www.liedman.net/leaflet-routing-machine/dist/leaflet-routing-machine.min.js" )

routingTemplate = "

" map$setTemplate( afterScript = sprintf(routingTemplate, RJSONIO::toJSON(mywaypoints)) ) map$set(width = 800, height = 800) map